Skip to content

Commit 1108a85

Browse files
committed
fix: update max-requests configuration to be dynamic based on worker count
1 parent 435491d commit 1108a85

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

apps/common/management/commands/services/services/gunicorn.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ def cmd(self):
1616

1717
log_format = '%(h)s %(t)s %(L)ss "%(r)s" %(s)s %(b)s '
1818
bind = f'{HTTP_HOST}:{HTTP_PORT}'
19+
max_requests = 10240 if int(self.worker) > 1 else 0
1920
cmd = [
2021
'gunicorn', 'smartdoc.wsgi:application',
2122
'-b', bind,
2223
'-k', 'gthread',
2324
'--threads', '200',
2425
'-w', str(self.worker),
25-
'--max-requests', '10240',
26+
'--max-requests', str(max_requests),
2627
'--max-requests-jitter', '2048',
2728
'--access-logformat', log_format,
2829
'--access-logfile', '-'

apps/common/management/commands/services/services/local_model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ def cmd(self):
2525
log_format = '%(h)s %(t)s %(L)ss "%(r)s" %(s)s %(b)s '
2626
bind = f'{CONFIG.get("LOCAL_MODEL_HOST")}:{CONFIG.get("LOCAL_MODEL_PORT")}'
2727
worker = CONFIG.get("LOCAL_MODEL_HOST_WORKER", 1)
28+
max_requests = 10240 if int(worker) > 1 else 0
2829
cmd = [
2930
'gunicorn', 'smartdoc.wsgi:application',
3031
'-b', bind,
3132
'-k', 'gthread',
3233
'--threads', '200',
3334
'-w', str(worker),
34-
'--max-requests', '10240',
35+
'--max-requests', str(max_requests),
3536
'--max-requests-jitter', '2048',
3637
'--access-logformat', log_format,
3738
'--access-logfile', '-'

0 commit comments

Comments
 (0)