Python应用服务器(Bjoern vs Gunicorn)

2024-06-25 23:58:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在测试pythonwsgi应用服务器。在

我正在运行bjoern,如下所示:

bjoern.run(wsgi_app, host, port)

古尼科恩也是这样:

^{pr2}$

然而,我注意到比约恩处理的请求数量是古尼康的一半。我正在进行基准测试的节点有2个vCPU。在

根据目前发表的许多文章(例如) https://dzone.com/articles/a-performance-analysis-of-python-wsgi-servers-part与Gunicorn相比,Bjoern在每秒处理多个请求方面应该要好得多。在

遵循此操作使Bjoren能够在多个核心上运行https://github.com/jonashaag/bjoern/blob/master/tests/fork.py

然而,Bjoern处理的请求仍然比Gunicorn处理的请求多出一点

Bjoren似乎在使用多个核心:

vin@TEST:~/api/src$ ps -U $USER -o pid,psr,comm | grep python
27880   1 python
27921   1 python
27922   1 python
vin@TEST:~/api/src$ ps -U $USER -o pid,psr,comm | grep python
27880   1 python
27921   1 python
27922   0 python
vin@TEST:~/api/src$ ps -U $USER -o pid,psr,comm | grep python
27880   1 python
27921   1 python
27922   1 python
vin@TEST:~/api/src$ ps -U $USER -o pid,psr,comm | grep python
27880   1 python
27921   1 python
27922   1 python
vin@TEST:~/api/src$ ps -U $USER -o pid,psr,comm | grep python
27880   1 python
27921   0 python
27922   0 python

有什么办法调试这个吗?在

[更新] 我使用的是3.2.0-115-virtual,它不支持sou-REUSEPORT。这会对请求/秒产生实质性影响吗?在


Tags: httpstestsrccomapiwsgipidgrep