Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a scenario where an application is hosted by multiple instances in Amazon EC2 (with load balancing), are multiple requests from the same user guaranteed to go to the same instance?

share|improve this question
I guess it depends on your load balancing mechanism\method and what type of affinity is in use. Can you elaborate on your setup? – joeqwerty Jun 16 '10 at 0:11
Sorry, don't have a setup yet -- Just wondering if I am forced to store session state in a database or if I can get by maintaining session state in memory. – Brian Webster Jun 16 '10 at 0:11
up vote 5 down vote accepted

From the Amazon Elastic Load Balancing summary page:

Elastic Load Balancing supports the ability to stick user sessions to specific EC2 instances.

share|improve this answer

It depends on your configuration. I don't make use of Amazon's Elastic Load Balancing (ELB) service as it doesn't allow me to log the client IP address as all connections appear to come from the LB equipment when seen by the EC2 instance. Instead I do my own load balancing via DNS and multiple Apache front-end servers that are setup to use sticky sessions from the same originating source address.

share|improve this answer
Jeremy, Thanks for the detailed answer. – Brian Webster Jun 16 '10 at 2:12
Don't mention it. I've been running several java application servers under EC2 for almost a year now. – Jeremy Bouse Jun 16 '10 at 3:49

Your Answer


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.