Reputation: 21
Currently I am working with AWS autoscaling feature. I have a question in implementing the load balancer and setting up the autoscaling triggers.
I have one EC2 Instance which is a red 5 media server and it broadcasts a live video stream to all the users. Now I want to know If I use auto scaling feature to scale up/down red 5 EC2 Instances, then how Load balancer will take care of user sessions?
e.g. If a user is logged in to one EC2 instance(red 5 media server) and he is viewing the live broadcast and due to low utilization load balancer decides to shut down this instance. In that case, how can we take care of the established session?
Thanking you in anticipation.
Upvotes: 1
Views: 1567
Reputation: 5286
You can turn on sticky sessions for the load balancer. That way if you spin up a new instance, the session will continue to go to a specific server and only new sessions will be directed to the new instance.
See : This Article
This was a recently added feature, but should solve any concerns you have with a user not always going to the same application server. You could also backup the sessions in a shared memcache server or in the database. If a user loses the session, before giving him a new one, check memcache for it, and return it.
Upvotes: 1