Hi Evgeny,
thanks a lot for shared your experience, very interesting. I'd like to
plug something magic that could avoid me configuring a filter, I
started investigating about a possible use of AOP & HttpSession.
If anyone is interested, I'll share my results when done.
Best regards!!!
Simo

http://people.apache.org/~simonetripodi/



On Tue, Feb 23, 2010 at 7:51 AM, Tsirkin Evgeny <tsir...@gmail.com> wrote:
> Just in case somebody will google for a solution for "replacing session".
> I have done this .
> First of all ,why:
> We have cluster of 2 machines .
> Each have a separate db on it .
> The machines are sharing information using nfs mounting fs.
> Each machine runs it's own apache server ,(no apache balancer in front).
> There IS a hardware load balancer in front of this but sometime it fails
> to route already open sessions to same host.
> So,we can't :
> 1. share sessions using files ,because this would be same file for 2 tomcats
>    and because this would fail on nfs .
> 2. we can't use tomcat cluster because there are cases when BOTH tomcat
>    would be shut down or restarted and session would be loosed.
> 3. we can't use a db because there is no central db - each host has it's own
> one.
> 4. to complicate issue machines could be added/removed to the cluster.
>
> What we did - override session object using filter.On each request start it
> would
> read it's info from db (any configured one ,but preferring the local one)
> On each request end it would write itself into ALL dbs that are configured
> to be
> used.
> Although the obvious problem here is the writing to more then 1 db and
> reading
> from a db on each request ,this really works good thanks for mysql to be
> so fast on simple read/write.
> I have even implemented a simple lock mechanism for session .
> What more - this solution is portable ,it worked for us on SunONE server
> and now on tomcat.
> Thanks
> Evgeny
> On Tue, Feb 16, 2010 at 9:54 PM, Simone Tripodi 
> <simone.trip...@gmail.com>wrote:
>
>> Hi Martin,
>> very interesting, thanks for share it!!! I did, more or less, the same
>> on a project for a customer, but it was strictly related to the
>> application, your stuff looks much much better of mine and it is a
>> reusable module.
>> All the best,
>> Simo
>>
>> http://people.apache.org/~simonetripodi/<http://people.apache.org/%7Esimonetripodi/>
>>
>>
>>
>> On Tue, Feb 16, 2010 at 6:02 PM, Martin Grotzke
>> <martin.grot...@javakaffee.de> wrote:
>> > Hi Jon,
>> >
>> > On Mon, 2010-02-15 at 11:55 -0600, Jon Brisbin wrote:
>> >> I'm trying to figure out today how I can implement a Valve or something
>> that can store a session to a backend DB and reload that session on another
>> Tomcat instance similar to how the PersistentManager loads user's session
>> after a restart.
>> >>
>> >> Would a Valve based on PersistentValve allow me to implement a
>> cluster-like solution such that a user login causes a write to a central
>> database and a load balanced request to another server would see that user
>> without forcing another login?
>> > You might have a look at the
>> > http://code.google.com/p/memcached-session-manager/ which is a session
>> > failover solution storing sessions in memcached.
>> >
>> > When the project was created I only thought of applications using sticky
>> > sessions but it should also work with non-sticky sessions if sessions
>> > are stored in memcached synchronously (sessionBackupAsync needs to be
>> > set to false, see [1]).
>> >
>> > The memcached-session-manager basically is a session manager
>> > implemention, the most interesting part is the
>> > MemcachedBackupSessionManager ([2]) if you want to have a look at the
>> > code.
>> >
>> > Cheers,
>> > Martin
>> >
>> >
>> > [1]
>> http://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration
>> > [2]
>> http://github.com/magro/memcached-session-manager/blob/master/core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSessionManager.java
>> >
>> >
>> >
>> >>
>> >> Jon Brisbin
>> >> Portal Webmaster
>> >> NPC International, Inc.
>> >>
>> >>
>> >>
>> >> On Feb 15, 2010, at 11:05 AM, Simone Tripodi wrote:
>> >>
>> >> > Hi all guys and very nice to meet the Tomcat community,
>> >> > I've a web-application that needs to be replicated in more than one
>> >> > Tomcat, and since it is HttpSession based, I need to enable the
>> >> > session replication.
>> >> > Even if I work with very good sysadmins that know how to do it, I'm
>> >> > curious and would like to know if I could replace the HttpSession
>> >> > implementation with a my own one, I'd like to integrate Hazelcast[1]
>> >> > for data synchronization.
>> >> > Thanks in advance, every suggestion will be very appreciated.
>> >> > Simo
>> >> >
>> >> > [1] http://www.hazelcast.com/
>> >> >
>> >> > http://people.apache.org/~simonetripodi/<http://people.apache.org/%7Esimonetripodi/>
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> >> > For additional commands, e-mail: users-h...@tomcat.apache.org
>> >> >
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> >> For additional commands, e-mail: users-h...@tomcat.apache.org
>> >>
>> >
>> > --
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to