Skip to content

Commit

Permalink
Fix gunicorn config for free sku (#1551)
Browse files Browse the repository at this point in the history
  • Loading branch information
pamelafox authored Apr 20, 2024
1 parent 0124725 commit 4633ded
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/backend/gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import multiprocessing
import os

max_requests = 1000
max_requests_jitter = 50
Expand All @@ -9,5 +10,9 @@
# https://learn.microsoft.com/en-us/troubleshoot/azure/app-service/web-apps-performance-faqs#why-does-my-request-time-out-after-230-seconds

num_cpus = multiprocessing.cpu_count()
workers = (num_cpus * 2) + 1
if os.getenv("WEBSITE_SKU") == "LinuxFree":
# Free tier reports 2 CPUs but can't handle multiple workers
workers = 1
else:
workers = (num_cpus * 2) + 1
worker_class = "uvicorn.workers.UvicornWorker"

0 comments on commit 4633ded

Please sign in to comment.