What are the pros and cons of starting (i) machine guns on a system-wide basis and (ii) installing a gun for a virtual virtual machine (assuming 5-6 virtual virtual machines on a 512 MB virtual machine)

I am running 5-6 sites on top of django. Each django project is in its own virtual space and serves one website.

I am currently installing gunicorn on virtualenv, and so each django project has its own installation and gun processes.

What are the pros and cons of this approach, as well as the alternative to installing a gun system, with a single gun installation that manages all sites (for example, the standard apache installation).

The environment is a 512 MB Ubuntu 11.04 virtual machine on linode. Of course, I use nginx for proxy requests to gunicorn.

+4
source share
2 answers

On the heap of our servers, we have as many as 10 different django applications that run their own machine gun in their own virtual space.

We use one system of supervisor processes to control them all.

We also have one nginx process that processes all traffic (reverse proxy serving static media, etc.) for all applications.

We decided to use this approach because it seems the most reasonable and easiest to configure and manage each application. Using a supervisor to start / stop / restart each application on its own gives us finer control over what we want to do. It also simplifies the addition of applications and does not affect those that are already on the machine.

It also allows us to run each application as a different user, so that we can better control what these processes are doing and that they have access, which is good if you need to worry about security. If these are all your own applications on your own server under your desk, this may not be a problem for you.

If you run one version of the machine guns for everything, and something happens to this shooting process, it will affect all your applications, which is not ideal. It also limits what you can do if you want to run the eventlet in one application, gevent on another and synchronize with another, easier if they all work separately. In addition, some applications may require more processes than others, and it is easier to configure if they are separate.

If you use the apache approach, this can reduce the shared resource of your resource, because you will not need to have several versions of the same processes that are executed for each application. If you are limited in resources, this may be more profitable for you, but these days the memory and processor are so cheap that this is not a problem.

A lot of this really depends on how much traffic each of these applications will receive. If you don’t get any traffic at all, do what is easiest to configure and maintain. If you receive a ton of traffic or plan to receive a ton, then what you have now may have to be changed again as soon as you outgrow the current setting.

+6
source

As I can see, you are talking about three options:

  • One Gunicorn Process for All Your Projects
  • One single Gunicorn installation with separate processes for each project
  • Multiple Gunicorn installations, one in each virtualenv

I'm not sure if the former is possible, but the Gunicorn docs all seem adapted to one of the other two options, and I think it should usually be created using one WSGI module. In addition, you also lose the ability to kill or restart servers for individual projects without disturbing others.

Regarding the installation of a separate Gunicorn for each virtual one, this is certainly an approach proposed by the Gunicorn team , and one that gives you the opportunity to use the functions of the new version of Gunicorn in a new project without potentially breaking existing versions.

Short answer: you need to have separate instances of Gunicorn for each project; regardless of whether you have a separate installation, it is up to you, but this will probably save you time and headaches.

+4
source

Source: https://habr.com/ru/post/1388587/


All Articles