4

There are a bunch of techniques I can think of for doing this:

  • Setting up a replica web-server on a different port and/or IP, then using DNS as load-balancer; restarting one server at a time
  • Utilising more explicit load-balancing (which PaaS such as Heroku and OpenShift use) with implicit replicas
  • Using some in-built mechanism (e.g.: in nginx)

I am working within an IaaS solution, and will be setting up git and some listeners to handle this whole setup.

What's the best method of restarting the web-server—so my latest revision of my Python web-app can go live—without noticeably affecting site visitors/users/clients?

Community
  • 1
  • 1
A T
  • 13,008
  • 21
  • 97
  • 158

1 Answers1

2

The simpler the better, no silver bullet.

  1. For single server, gracefully restart mechanism can be helpful. It will start new processes to accept new requests, and maintain the old processes till the old requests finished. Nginx already using this, see http://wiki.nginx.org/CommandLine#Stopping_or_Restarting_Nginx

  2. For multiple servers, using reverse proxy is a good practice. An example structure looks like this, and it can be easily build using Nginx: enter image description here If some of backend servers broken down, the reverse proxy can dispatch requests to other healthy servers and will not affect users. You can customize the load balancing strategy to do fine-grained control. And you can also flexible add server for scaling up, or pick off server for trouble shooting or code updating.

TroyCheng
  • 571
  • 3
  • 10