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

When a user comes to my site, I want him to hit one server during his browsing period. I don't want him to jump from server to server as he pages through my site.

I want his "session" to be kept to that server only.

How can I do that with load balancer?

share|improve this question
up vote 3 down vote accepted

Well, technically that's what round-robin is - sending each connection to a different server in sequential order.

What you're referring to is usually called persistence, or stickiness, and the EC2 load balancer can achieve this by inserting cookies into the HTTP stream. It can generate its own cookies and then check for the value on subsequent requests. So the cookie might say something like "Server 1" and the load balancer knows to send the connection back to server 1. You can also make use of existing application cookies. See:


The drawback is that the client must have cookies enabled in their browser.

share|improve this answer

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.