0

Large websites like Google need to make sure that it's services are always available. At the same time Google frequently upgrades it's server side code. And users won't even notice this, they can just use Google as usual.

For now, when I need to change my server side code(php ,python or cgi scripts etc), I will shutdown the server, replace the previous version code, and restart the server. This way is not perfect, users will have to wait for server minutes.

How can I upgrade my server side code quietly without disturbing users?

5
  • 1
    High-availability; multiple backend servers that the user doesn't know about, thinking they're accessing just the one web service (much as you do with google). Take one backend server out the pool, upgrade the app, drop it back in, repeat for all backend servers, go to pub.
    – MadHatter
    Oct 2, 2013 at 16:11
  • @MadHatter That should be the brief description of the key mechanism, but how to implement? Is there any practical software or more detailed tutorial? Oct 2, 2013 at 16:17
  • 1
    I offered that as a comment not an answer, because it's just an outline sketch, not worthy of being a full answer. But if what you want is a pointer to learning materials, that is explicitly off-topic for SF; and if you want a full-length HOWTO here, that would require a book, so the question is too broad for SF and so also, in my opinion, liable for closure. What you need is high-availability; go google for it, and learn elsewhere. When you've picked a particular scheme, and you run into implementation problems, those are suitable for SF; come then and post them.
    – MadHatter
    Oct 2, 2013 at 16:23
  • 1
    I'll go so far as to say that LVS, with the director duplicated under Linux-HA, is the way I'd do this, at least for a web service. Now you have something explicit to google for.
    – MadHatter
    Oct 2, 2013 at 16:26
  • @MadHatter Ok, get it, I fully understand and respect serverfault's effort of following the rules to keep high quality. I got the key words "High-availability, multiple servers, LVS, Linux-HA" from your comment, thanks. Oct 2, 2013 at 16:28

1 Answer 1

1

Basically the simplest way to do it this is to have multiple application servers (2 minimum) behind a loadbalancer like HAProxy and do a rolling restart. So basically like this:

  1. Disable traffic to half of your servers (see haproxyctl on github for details)
  2. Push your code changes to the application server
  3. Restart that half of the application
  4. Repeat for other half

There are other ways to do this as well like zero downtime restarts in Unicorn, but thats the simplest and works with pretty much every application.

Here's a good article from Amazon on loadbalancing as well: https://aws.amazon.com/articles/1639

1
  • Very detailed guide, "loadbalancing, HAProxy, zero downtime...", Thanks. Oct 3, 2013 at 1:51

Not the answer you're looking for? Browse other questions tagged .