Skip to content

Commit c1ed5c8

Browse files
authored
use os.sched_getaffinity for cgroup-aware CPU count in gunicorn config. Closes GreedyBear-Project#1194 (GreedyBear-Project#1205)
1 parent a3d5bff commit c1ed5c8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

configuration/gunicorn/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import multiprocessing
1+
import os
22

33
# Server socket
44
bind = "unix:/run/gunicorn/main.sock"
55

66
# Worker processes
7-
workers = 2 * multiprocessing.cpu_count() + 1
7+
workers = 2 * len(os.sched_getaffinity(0)) + 1
88
max_requests = 1000
99
max_requests_jitter = 50
1010

0 commit comments

Comments
 (0)