bossadvisors / memcached-session-manager

Automatically exported from code.google.com/p/memcached-session-manager
0 stars 0 forks source link

Make backup storage pluggable #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Make backup storage pluggable, so that another backend instead of memcached 
might be used, e.g. [http://ehcache.org/documentation/cache_server.html 
ehcache server]

Original issue reported on code.google.com by martin.grotzke on 24 Oct 2009 at 11:21

GoogleCodeExporter commented 9 years ago
or redis server, would be nice.  if you can define the  storage interface , I 
can work on the redis implementation. 

best regards,
Gunay Arslan

Original comment by gunay.ar...@aerobilet.com on 8 Jul 2012 at 1:15

GoogleCodeExporter commented 9 years ago
HI ,

I did try to make a pluggable storage system. the patch is attached. Let me 
know what you think. 

example for memcahed

 <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
          memcachedNodes="http://192.168.1.1:8091/pools"
          sticky="true"
          sessionBackupAsync="true"
          requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css)$"
          transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory" 

          storage.username="sessions"
          storage.password="11111111"
          storage.memcachedProtocol="binary"
          storageFactoryClass="de.javakaffee.web.msm.storage.memcached.MemcachedConnectionFactory" />

example for redis

<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
          memcachedNodes="http://192.168.1.1:8091/pools"
          sticky="true"
          sessionBackupAsync="true"
          requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css)$"
          transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory" 

          storage.host="192.168.1.1"
          storage.password="111111"
          storage.database="1"
          storageFactoryClass="de.javakaffee.web.msm.storage.redis.RedisConnectionFactory" />
   </Manager>

Original comment by gunay.ar...@gmail.com on 8 Jul 2012 at 5:17

Attachments:

GoogleCodeExporter commented 9 years ago
attached is fully working copy for memcached and redis. added a proxy storage , 
so that you can "transfer" sessions from one storage to another , transparently 
. Sorry for the lack of documentation.

Here is an example configuration  configured redis as master , and memcached as 
slave. I am trying to move all the sessions from slave to master.

Now I feel better,when I have a chance to contribute back.

<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
          memcachedNodes="http://192.168.1.1:8091/pools"
          sticky="true"
          sessionBackupAsync="true"
          requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css)$"
          transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory" 

          storage.masterClass="de.javakaffee.web.msm.storage.redis.RedisConnectionFactory"
          storage.slaveClass="de.javakaffee.web.msm.storage.memcached.MemcachedConnectionFactory"

          storage.transferToMaster="true"
          storage.deleteIfFoundOnSlave="false"

          storage.master.host="127.0.0.1"
          storage.master.database="1"
          storage.slave.username="Sessions"
          storage.slave.password="xxxx"
          storage.slave.memcachedProtocol="binary"
          storageFactoryClass="de.javakaffee.web.msm.storage.proxy.ProxyStorageFactory" /> 

best regards,

Gunay Arslan

Original comment by gunay.ar...@gmail.com on 8 Jul 2012 at 8:44

Attachments:

GoogleCodeExporter commented 9 years ago
Great work, Gunay! I didn't have a look through the complete changeset, do you 
mind submitting a pull request on github?

Thanx && cheers,
Martin

Original comment by martin.grotzke on 9 Jul 2012 at 9:18

GoogleCodeExporter commented 9 years ago
Thank you Martin,

what you mean by "pull request " ? What I need to do ? Right now I have a ready 
only account for the git project. 

Original comment by gunay.ar...@gmail.com on 9 Jul 2012 at 6:58

GoogleCodeExporter commented 9 years ago
Check out https://help.github.com/articles/using-pull-requests for a complete 
description.

TL;DR: fork the repo (from your github account in the web-frontend), make your 
changes (in a topic-branch) and submit pull-request (also via web-frontend). 
Then we can discuss changes in github.

Original comment by martin.grotzke on 9 Jul 2012 at 7:33

GoogleCodeExporter commented 9 years ago
Thank you Martin. 

Did send the pull request. 

Original comment by gunay.ar...@gmail.com on 9 Jul 2012 at 8:18

GoogleCodeExporter commented 9 years ago
Great, I'll comment in github...

Original comment by martin.grotzke on 10 Jul 2012 at 1:59

GoogleCodeExporter commented 9 years ago
Btw, I'm commenting when may day job needs some compile time or anything else. 
So it may take some time until I'm through :-) I'll let you know when I 
finished commenting.

Original comment by martin.grotzke on 10 Jul 2012 at 2:34

GoogleCodeExporter commented 9 years ago
Sorry for the long delay. Unfortunately I didn't find the time to go through 
all changes until now.

Looking at the config I have one question: how are dotted attributes like 
'storage.memcachedProtocol="binary"' resolved, how does tomcat know where/how 
to set e.g. memcachedProtocol? Is this documented somewhere?

Some questions regarding attributes, and if they should be moved to storage:

1) What about memcachedNodes (and failoverNodes), shouldn't this be moved to 
storage.memcachedNodes (with 
storageFactoryClass="de.javakaffee.web.msm.storage.memcached.MemcachedConnection
Factory")?

2) Regarding redis storage: Jedis seems not to support async commands. This 
raises the question, what to do with sessionBackupAsync attribute (+ 
backupThreadCount and sessionBackupTimeout), as it does not make sense for 
redis.

Btw, from thursday next week I'll be on vacation for 4 weeks, so I will find 
time to work on this when I'm back.

Cheers,
Martin

Original comment by martin.grotzke on 1 Aug 2012 at 11:57

GoogleCodeExporter commented 9 years ago
Did this patch make it any further?

Original comment by downch...@gmail.com on 5 Apr 2013 at 7:33

GoogleCodeExporter commented 9 years ago
Nope, you can check the status of the related pull request. If you're willing 
to help you're welcome! :-)

Original comment by martin.grotzke on 5 Apr 2013 at 7:45

GoogleCodeExporter commented 9 years ago
Related pull request: https://github.com/magro/memcached-session-manager/pull/18

Original comment by downch...@gmail.com on 10 Apr 2013 at 11:37

GoogleCodeExporter commented 9 years ago
Thanx, I forgot to add the link :-)

Original comment by martin.grotzke on 10 Apr 2013 at 12:50