Skip to content

Commit

Permalink
Hardcode worker/thread config
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenyu committed Feb 8, 2024
1 parent 85561df commit 525e90d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/gunicorn.conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

app_config = AppConfig()

bind = app_config.host + ':' + str(app_config.port)
bind = app_config.host + ":" + str(app_config.port)
# Calculates the number of usable cores and doubles it. Recommended number of workers per core is two.
# https://docs.gunicorn.org/en/latest/design.html#how-many-workers
# We use 'os.sched_getaffinity(pid)' not 'os.cpu_count()' because it returns only allowable CPUs.
# os.sched_getaffinity(pid): Return the set of CPUs the process with PID pid is restricted to.
# os.cpu_count(): Return the number of CPUs in the system.
workers = len(os.sched_getaffinity(0)) * 2
threads = 4
workers = 1
threads = 2

0 comments on commit 525e90d

Please sign in to comment.