6

Python 起多个线程会充分用到多核 cpu 的资源吗

 2 years ago
source link: https://www.v2ex.com/t/788109
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Python

Python 起多个线程会充分用到多核 cpu 的资源吗

  longmeier90 · 21 小时 45 分钟前 · 452 次点击
我们公司的项目是用 django+supervisor+gunicorn 配的, 
启着几个 workers 监听着: 
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = 'sync'
但是现在我们的一些统计报表导出会导致我们的服务器 cpu 报警、mysql 服务器 cpu 也会经常报警。

这种情况下是
1.升级一下 cpu 配置从目前的 4 核升级到 8 核,
2.还是买一个同样配置的服务器重新部署一套,来个负载均衡。
哪一个更好,想着是那种一劳永逸的解决。
我目前更倾向于后者总感觉 python 线程没有真正把多核 cpu 的资源利用起来。

各位大佬给个建议


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK