英文:
Gunicorn is getting slow after project start or restart
问题
我已在“Centos 7”操作系统上部署了我的Django项目,使用了Posgresql、Nginx和Gunicorn。在项目运行或重新启动几分钟后,它变得非常慢。但是项目没有错误或响应问题。可以确定这不是与数据库相关的问题。需要考虑的一点是,我的项目承受了相当大的负载。
以下是gunicorn.service的配置:
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=user
Group=nginx
WorkingDirectory=/home/user/myproject
ExecStart=/home/user/myproject/myprojectenv/bin/gunicorn --workers 3 --bind unix:/home/user/myproject/myproject.sock myproject.wsgi:application
[Install]
WantedBy=multi-user.target
已检查网络、CPU负载和数据库负载,一切都正常。不知道出了什么问题。
英文:
I have deployed my django project on "Centos 7" OS with posgresql, nginx and gunicorn. After couple of minutes of project is running or restart, it's getting so slow. But there is no errors in the project or responses. It's for sure not db related issue. One thing to take into considiration that, my project gets quite big load
gunicorn.service is given below:
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=user
Group=nginx
WorkingDirectory=/home/user/myproject
ExecStart=/home/user/myproject/myprojectenv/bin/gunicorn --workers 3 --bind unix:/home/user/myproject/myproject.sock myproject.wsgi:application
[Install]
WantedBy=multi-user.target```
checked network, cpu load, db load. Everything is fine. No idea what is wrong
</details>
# 答案1
**得分**: 1
根据CPU核心数更改工作人员数量
<details>
<summary>英文:</summary>
change workers number according to cpu cores
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论