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

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

1 Answer 1

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: http://aws.amazon.com/about-aws/whats-new/2010/04/08/support-for-session-stickiness-in-elastic-load-balancing/

and

http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/DeveloperGuide/

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

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.