简体   繁体   English

Django Rest 带有 gunicorn 部署的框架应用程序

[英]Django Rest Framework application with gunicorn deployment

I have a django rest framework application that is using class style views.我有一个使用 class 样式视图的 django rest 框架应用程序。

My deployment is simple: gunicorn --workers=4 application_name.wsgi -b 0.0.0.0:8000我的部署很简单: gunicorn --workers=4 application_name.wsgi -b 0.0.0.0:8000

The issue is that it takes only 4 requests at a time.问题是一次只需要 4 个请求。 If I send 20 requests concurrently, it processes them in groups of 4 at a time.如果我同时发送 20 个请求,它会一次处理 4 个请求。

What do I have to do so that it processes all 20 requests concurrently?我该怎么做才能同时处理所有 20 个请求?

According to the gunicorn docs , you need to set threads parameter in order to process requests concurrently, for example,根据gunicorn docs ,您需要设置threads参数才能同时处理请求,例如,

gunicorn --workers=4 --threads=10 application_name.wsgi -b 0.0.0.0:8000 gunicorn --workers=4 --threads=10 application_name.wsgi -b 0.0.0.0:8000

will bring up 4 workers and each worker has 10 threads to process the requests.将带来 4 个工作人员,每个工作人员有 10 个线程来处理请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM