Gunicorn在项目启动或重启后变得缓慢

huangapple go评论68阅读模式
英文:

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>



huangapple
  • 本文由 发表于 2023年6月15日 19:11:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76481873.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定