Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

One of my sites is hosted via Amazon EC2 service. The problem starts happening when the site faces a heavy load which in turn spawns a new EC2 instance via AutoScaling. This is good but the issue is when these instances are killed (due to lack of load) the session information is also lost, and hence forcing the user to re-login in to the site.

What is the best way to approach this problem?

I have looked in to Memcached Session Manager & it works fine for Sticky sessions but causing problems when I try to use Non-sticky sessions since I make a lot of parallel requests to my server.

My current server is Apache+Tomcat

Any pointers helpful. Thanks.

(cross post from webmasters.stackexchange)

share|improve this question

1 Answer 1

up vote 5 down vote accepted

If your autoscaling instances can be terminated at any time and you can't afford to lose session information, then you can't store session information on the autoscaling instances.

If you have a database (e.g., MySQL, RDS) you could store sessions there. This works ok for lower to medium volume web sites, but can break with higher volume.

You could run separate instance(s) with memcached that are not autoscaled.

You might also consider Amazon ElastiCache (just released):

http://aws.amazon.com/elasticache/

This is Memcached protocol compatible, so existing web server session plugin software should be able to work without much problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.