The number of Gunicorn workers is generally configured from an experience point of view 2 * core + 1, core refers to the number of cores.
Supervisor does not have the concept of configuring the number of workers, but it has the concept of configuring the number of processes, numprocs this field
If you use gunicorn, it is generally recommended to use worker_class 配置成 gevent, you know this.
So, for the subject’s dual-core server, it should be set to 5 appropriately.
And supervisor 是一个进程管理工具,可以用于管理N多的进程,不仅仅是 Gunicorn ,我甚至用来管理 Redis。确实,supervisor 中也存在类似worker数量的东西,叫procs,其实是进程数量,也就是说你配置了几个,supervisor will help you start several processes.
It should be noted that the workers of supervisor 和 Gunicorn are independent. If you set both of them to 5, then there will actually be 5 * 5 = 25 processes providing services.
nginx is generally used for reverse proxy and load balancing. Suppose you have two web applications running locally on the server:
http://127.0.0.1:5000 Blog
http://127.0.0.1:8080 Forum
Then you want to access these two applications separately through domain names, for example
http://baidu.com/blog blog
http://baidu.com/bss Forum
Then this can be configured through nginx.
gevent 是协程的一个库,一般用于 IO密集型 应用,不建议使用。如果是IO密集型 应用,建议使用 Tornado Framework for writing.
That’s about it. It is recommended to read more official documents.
Whatever
worker
还是Nginx
的Process
,都是根据你的服务器的CPU
核数决定的,你的阿里云只有双核(2个核
)?gunicorn
不是很了解,uWSGI
也有个worker
,一般设置成核数X2
.Nginx
据说8
One process is enough.Search
Nginx
optimization online, there should be quite a few tutorials.About
worker
这个基本上是建议等于实际CPU
核心数的一到两倍,我一般是有几个核,就用几个worker
.As for the settings of
supervisor
我好像并没有看到有关worker
.Actually, I use
uwsgi
+supervisor
+nginx
的组合。具体你可以google
下,我也只是照着官方wiki
to make it, and I don’t use anything fancy.PS: Give up the Chinese materials, most of them are in disrepair. Although the English is not easy to read, at least you can’t get into the pit
The number of Gunicorn workers is generally configured from an experience point of view
2 * core + 1
, core refers to the number of cores.Supervisor does not have the concept of configuring the number of workers, but it has the concept of configuring the number of processes,
numprocs
this fieldIf you use gunicorn, it is generally recommended to use
worker_class
配置成gevent
, you know this.gunicorn
是常用的 WSGI 服务器,在目前应用中,和uWSGI
都是比较常用的选择,而两者性能都相差不远。gunicorn
配置的 worker 数量官网的示例值是2 * cpu数 + 1
, official website exampleSo, for the subject’s dual-core server, it should be set to
5
appropriately.And
supervisor
是一个进程管理工具,可以用于管理N多的进程,不仅仅是Gunicorn
,我甚至用来管理Redis
。确实,supervisor
中也存在类似worker
数量的东西,叫procs
,其实是进程数量,也就是说你配置了几个,supervisor
will help you start several processes.It should be noted that the workers of
supervisor
和Gunicorn
are independent. If you set both of them to 5, then there will actually be 5 * 5 = 25 processes providing services.nginx
is generally used for reverse proxy and load balancing. Suppose you have two web applications running locally on the server:http://127.0.0.1:5000 Blog
http://127.0.0.1:8080 Forum
Then you want to access these two applications separately through domain names, for example
http://baidu.com/blog blog
http://baidu.com/bss Forum
Then this can be configured through nginx.
gevent
是协程的一个库,一般用于IO密集型
应用,不建议使用。如果是IO密集型
应用,建议使用Tornado
Framework for writing.That’s about it. It is recommended to read more official documents.