bman
bman

Reputation: 3780

Amazon EC2 ELB directing load to other instances and session stores

If we scale up (add an instance to ELB), could we redirect some existing requests to the new instance. So that, The users that we force to a new server will be asked to login again

If we scale down (remove an instance from ELB), then all users from that server will automatically be redirected by ELB to other remaining servers. These user should not be aked to login again.

Is this possible (including the redirect of request)? How?

Any ideas are welcome but I presume this can be solved using a central session store. I just don't know how to implement it .

And what are the options in using a central session store? simpledb? redis? memcached?

Our application is just a simple web application hosted in apache. We have two instances of it added unto the Amazon ELB, and we are using PHP.

Any ELB php specific suggestions? when a scale down/up happens that no user-visible symptomps should be shown?

Upvotes: 0

Views: 1158

Answers (2)

Rakesh Sankar
Rakesh Sankar

Reputation: 9415

There are quite a bunch of ways to have a centralized session management. Some of them are listed below:

DB:

http://ocklin.org/session_management_cluster.html

Memcache:

  1. http://www.migrate2cloud.com/blog/how-to-configure-memcached-on-aws-ec2-a-starters-guide (make sure the hosts are able to connect without any problem),
  2. http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/
  3. http://php.net/manual/en/memcached.sessions.php

Msession:

http://in.php.net/manual/en/ref.msession.php

Upvotes: 1

sdolgy
sdolgy

Reputation: 7001

For the most part, this should be completely transparent to your end users without many changes on your end.

The biggest aspect to look at on your side will be ensuring that sessions are persisted / available through the addition / removal of instances.

You can do this by setting a cookie on the client (default behavior in session_start() and ensuring all of your web servers with PHP have the facility to obtain information about the session id.

Some people will use memcached to do this ... and there is native integration in PHP for sessions to be stored in memcached ...

Upvotes: 1

Related Questions