How to achieve zero downtime deployment?

Most websites need to be up 24 hours every day, so we need a solution to deploy changes to the website without taking it down. The solution is to have more than one application server and use a load balancer. You have your application running on one of the servers and when you need to make changes, you deploy the new version on the other server. Now when a user is currently using the website he will still be using the old version, but when he connects to the website the next time he will be redirected to the other server with the new version. As long as there are sessions on the old version it keeps running, and when all the sessions are on the new server you can take down the old version and keep that server free for the next time you need to deploy changes.
1 answer