You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by an...@gmail.com on 2009/12/12 03:37:52 UTC

Storing Tomcat Sessions to MySQL (and Memcached) Round-Robin without sticky sessions

Hello, Thanks in advance for your help.

I would like to know if anyone is currently modifying, has modified,
or plans to modify Tomcat 6.0.20 to store/read sessions directly in
Memcached + MySQL to enable session persistence with round-robin and
without sticky sessions?

If so would you be so kind as to point me in the right direction?

Our top level design requirement is 'no sticky sessions' + 'round
robin' + 'MySQL or Amazon SimpleDB'

After getting this solution working I would like to donate the code to
the Tomcat project. It will be useful for those wishing to deploy
Tomcat + Amazon EC2 + Amazon Elastic Load Balancer.

Thank you,
Anthony
925-456-4343

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Storing Tomcat Sessions to MySQL (and Memcached) Round-Robin without sticky sessions

Posted by ma...@mohawksoft.com.
> On 17/12/2009 20:24, markw@mohawksoft.com wrote:
>>> Hi Mark, Thanks for the reply.
>>>
>>> In your opinion should we be using local memory to store any session
>>> data? The discussion right now is to store everything to cache+db and
>>> nothing in local memory.
>>
>> The problem with any cache system is cache coherency. Tomcat takes the
>> easy way out by requiring that sessions be "sticky" to a single box, and
>> using local access management. Sticky session have well known
>> scalability
>> issues.
>
> 1. Please take this to the users list.

I didn't start this thread and am not sure how to do that.

>
> 2. You are making some strong statements here regarding the current
> implementation with little in the way of hard data to back up those
> statements. You might want to consider including some justification in
> future postings.

Problems with sticky sessions:

What happens to the sticky sessions when the a server crashes or is taken
out of service after peak load?

Load balancing on "sticky" servers tends to be less efficient because user
requests can't be sent to the "next least loaded" server, they have to be
sent to a particular server which may not be the least busy.

When you dynamically add servers to a server farm to manage load during
peak times, the "sticky" load does not get reduced unless you invalidate
the sessions and recreated them.

Sessions that reside solely on a specific server box are very limited. If
they are in a globally shared and managed environment, they can be used by
other systems.

That is just the ones off the top of my head.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Storing Tomcat Sessions to MySQL (and Memcached) Round-Robin without sticky sessions

Posted by Mark Thomas <ma...@apache.org>.
On 17/12/2009 20:24, markw@mohawksoft.com wrote:
>> Hi Mark, Thanks for the reply.
>>
>> In your opinion should we be using local memory to store any session
>> data? The discussion right now is to store everything to cache+db and
>> nothing in local memory.
> 
> The problem with any cache system is cache coherency. Tomcat takes the
> easy way out by requiring that sessions be "sticky" to a single box, and
> using local access management. Sticky session have well known scalability
> issues.

1. Please take this to the users list.

2. You are making some strong statements here regarding the current
implementation with little in the way of hard data to back up those
statements. You might want to consider including some justification in
future postings.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Storing Tomcat Sessions to MySQL (and Memcached) Round-Robin without sticky sessions

Posted by ma...@mohawksoft.com.
> Hi Mark, Thanks for the reply.
>
> In your opinion should we be using local memory to store any session
> data? The discussion right now is to store everything to cache+db and
> nothing in local memory.

The problem with any cache system is cache coherency. Tomcat takes the
easy way out by requiring that sessions be "sticky" to a single box, and
using local access management. Sticky session have well known scalability
issues.

The "right" answer, for an arbitrary definition of "right," is a little
more complicated.

A UDP based server to reduce the TCP/IP overhead.
The protocol should be something like this: (pseudo code)

class Session
{
    UUID session;

}
Object lockSession(uuid session)
Object lockSession(Object session)
void unlockSession(Object session)
void abandonSession(uuid session)
Object peekSession(uuid session)
Object peekSession(Object session)




> On Sat, Dec 12, 2009 at 5:06 AM, Mark Woodward <ma...@mohawksoft.com>
> wrote:
>> About 12 years ago, I wrote a system called msession for PHP that was
>> basically a high-speed cache for sessions. I have been using it for PHP
>> sites ever since. The one thing I've never liked about tomcat is sticky
>> sessions. It doesn't scale well enough. With gig ethernet, a shared
>> network
>> based caching system is probably the best way to go.
>>
>> Also, it would be good if the format of the session data could be used
>> by
>> other platforms, i.e. PHP and Tomcat could share sessions.
>>
>> Is anyone actively working on the session management of tomcat?
>>
>>
>> anthonyvierra@gmail.com wrote:
>>>
>>> Hello, Thanks in advance for your help.
>>>
>>> I would like to know if anyone is currently modifying, has modified,
>>> or plans to modify Tomcat 6.0.20 to store/read sessions directly in
>>> Memcached + MySQL to enable session persistence with round-robin and
>>> without sticky sessions?
>>>
>>> If so would you be so kind as to point me in the right direction?
>>>
>>> Our top level design requirement is 'no sticky sessions' + 'round
>>> robin' + 'MySQL or Amazon SimpleDB'
>>>
>>> After getting this solution working I would like to donate the code to
>>> the Tomcat project. It will be useful for those wishing to deploy
>>> Tomcat + Amazon EC2 + Amazon Elastic Load Balancer.
>>>
>>> Thank you,
>>> Anthony
>>> 925-456-4343
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Storing Tomcat Sessions to MySQL (and Memcached) Round-Robin without sticky sessions

Posted by an...@gmail.com.
Hi Mark, Thanks for the reply.

In your opinion should we be using local memory to store any session
data? The discussion right now is to store everything to cache+db and
nothing in local memory.

On Sat, Dec 12, 2009 at 5:06 AM, Mark Woodward <ma...@mohawksoft.com> wrote:
> About 12 years ago, I wrote a system called msession for PHP that was
> basically a high-speed cache for sessions. I have been using it for PHP
> sites ever since. The one thing I've never liked about tomcat is sticky
> sessions. It doesn't scale well enough. With gig ethernet, a shared network
> based caching system is probably the best way to go.
>
> Also, it would be good if the format of the session data could be used by
> other platforms, i.e. PHP and Tomcat could share sessions.
>
> Is anyone actively working on the session management of tomcat?
>
>
> anthonyvierra@gmail.com wrote:
>>
>> Hello, Thanks in advance for your help.
>>
>> I would like to know if anyone is currently modifying, has modified,
>> or plans to modify Tomcat 6.0.20 to store/read sessions directly in
>> Memcached + MySQL to enable session persistence with round-robin and
>> without sticky sessions?
>>
>> If so would you be so kind as to point me in the right direction?
>>
>> Our top level design requirement is 'no sticky sessions' + 'round
>> robin' + 'MySQL or Amazon SimpleDB'
>>
>> After getting this solution working I would like to donate the code to
>> the Tomcat project. It will be useful for those wishing to deploy
>> Tomcat + Amazon EC2 + Amazon Elastic Load Balancer.
>>
>> Thank you,
>> Anthony
>> 925-456-4343
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Storing Tomcat Sessions to MySQL (and Memcached) Round-Robin without sticky sessions

Posted by an...@gmail.com.
Could you guys have a peek at the description here and see if i'm
missing anything
http://code.google.com/p/tomcat-nonstick-session-manager/

On Mon, Dec 14, 2009 at 11:56 AM,  <an...@gmail.com> wrote:
> We will be developing the "NON-STICK" session manager here under the
> Apache 2.0 License.
> http://code.google.com/p/tomcat-nonstick-session-manager/
>
> On Sat, Dec 12, 2009 at 5:06 AM, Mark Woodward <ma...@mohawksoft.com> wrote:
>> About 12 years ago, I wrote a system called msession for PHP that was
>> basically a high-speed cache for sessions. I have been using it for PHP
>> sites ever since. The one thing I've never liked about tomcat is sticky
>> sessions. It doesn't scale well enough. With gig ethernet, a shared network
>> based caching system is probably the best way to go.
>>
>> Also, it would be good if the format of the session data could be used by
>> other platforms, i.e. PHP and Tomcat could share sessions.
>>
>> Is anyone actively working on the session management of tomcat?
>>
>>
>> anthonyvierra@gmail.com wrote:
>>>
>>> Hello, Thanks in advance for your help.
>>>
>>> I would like to know if anyone is currently modifying, has modified,
>>> or plans to modify Tomcat 6.0.20 to store/read sessions directly in
>>> Memcached + MySQL to enable session persistence with round-robin and
>>> without sticky sessions?
>>>
>>> If so would you be so kind as to point me in the right direction?
>>>
>>> Our top level design requirement is 'no sticky sessions' + 'round
>>> robin' + 'MySQL or Amazon SimpleDB'
>>>
>>> After getting this solution working I would like to donate the code to
>>> the Tomcat project. It will be useful for those wishing to deploy
>>> Tomcat + Amazon EC2 + Amazon Elastic Load Balancer.
>>>
>>> Thank you,
>>> Anthony
>>> 925-456-4343
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Storing Tomcat Sessions to MySQL (and Memcached) Round-Robin without sticky sessions

Posted by an...@gmail.com.
We will be developing the "NON-STICK" session manager here under the
Apache 2.0 License.
http://code.google.com/p/tomcat-nonstick-session-manager/

On Sat, Dec 12, 2009 at 5:06 AM, Mark Woodward <ma...@mohawksoft.com> wrote:
> About 12 years ago, I wrote a system called msession for PHP that was
> basically a high-speed cache for sessions. I have been using it for PHP
> sites ever since. The one thing I've never liked about tomcat is sticky
> sessions. It doesn't scale well enough. With gig ethernet, a shared network
> based caching system is probably the best way to go.
>
> Also, it would be good if the format of the session data could be used by
> other platforms, i.e. PHP and Tomcat could share sessions.
>
> Is anyone actively working on the session management of tomcat?
>
>
> anthonyvierra@gmail.com wrote:
>>
>> Hello, Thanks in advance for your help.
>>
>> I would like to know if anyone is currently modifying, has modified,
>> or plans to modify Tomcat 6.0.20 to store/read sessions directly in
>> Memcached + MySQL to enable session persistence with round-robin and
>> without sticky sessions?
>>
>> If so would you be so kind as to point me in the right direction?
>>
>> Our top level design requirement is 'no sticky sessions' + 'round
>> robin' + 'MySQL or Amazon SimpleDB'
>>
>> After getting this solution working I would like to donate the code to
>> the Tomcat project. It will be useful for those wishing to deploy
>> Tomcat + Amazon EC2 + Amazon Elastic Load Balancer.
>>
>> Thank you,
>> Anthony
>> 925-456-4343
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Storing Tomcat Sessions to MySQL (and Memcached) Round-Robin without sticky sessions

Posted by an...@gmail.com.
I would like to attempt to get the team to complete this next week. At
this point we are looking at the session manager. Is there some other
area we should look at modifying?

On Sat, Dec 12, 2009 at 5:06 AM, Mark Woodward <ma...@mohawksoft.com> wrote:
> About 12 years ago, I wrote a system called msession for PHP that was
> basically a high-speed cache for sessions. I have been using it for PHP
> sites ever since. The one thing I've never liked about tomcat is sticky
> sessions. It doesn't scale well enough. With gig ethernet, a shared network
> based caching system is probably the best way to go.
>
> Also, it would be good if the format of the session data could be used by
> other platforms, i.e. PHP and Tomcat could share sessions.
>
> Is anyone actively working on the session management of tomcat?
>
>
> anthonyvierra@gmail.com wrote:
>>
>> Hello, Thanks in advance for your help.
>>
>> I would like to know if anyone is currently modifying, has modified,
>> or plans to modify Tomcat 6.0.20 to store/read sessions directly in
>> Memcached + MySQL to enable session persistence with round-robin and
>> without sticky sessions?
>>
>> If so would you be so kind as to point me in the right direction?
>>
>> Our top level design requirement is 'no sticky sessions' + 'round
>> robin' + 'MySQL or Amazon SimpleDB'
>>
>> After getting this solution working I would like to donate the code to
>> the Tomcat project. It will be useful for those wishing to deploy
>> Tomcat + Amazon EC2 + Amazon Elastic Load Balancer.
>>
>> Thank you,
>> Anthony
>> 925-456-4343
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Storing Tomcat Sessions to MySQL (and Memcached) Round-Robin without sticky sessions

Posted by Mark Woodward <ma...@mohawksoft.com>.
About 12 years ago, I wrote a system called msession for PHP that was 
basically a high-speed cache for sessions. I have been using it for PHP 
sites ever since. The one thing I've never liked about tomcat is sticky 
sessions. It doesn't scale well enough. With gig ethernet, a shared 
network based caching system is probably the best way to go.

Also, it would be good if the format of the session data could be used 
by other platforms, i.e. PHP and Tomcat could share sessions.

Is anyone actively working on the session management of tomcat?


anthonyvierra@gmail.com wrote:
> Hello, Thanks in advance for your help.
>
> I would like to know if anyone is currently modifying, has modified,
> or plans to modify Tomcat 6.0.20 to store/read sessions directly in
> Memcached + MySQL to enable session persistence with round-robin and
> without sticky sessions?
>
> If so would you be so kind as to point me in the right direction?
>
> Our top level design requirement is 'no sticky sessions' + 'round
> robin' + 'MySQL or Amazon SimpleDB'
>
> After getting this solution working I would like to donate the code to
> the Tomcat project. It will be useful for those wishing to deploy
> Tomcat + Amazon EC2 + Amazon Elastic Load Balancer.
>
> Thank you,
> Anthony
> 925-456-4343
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org