You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dirty Arbiters provide a separate process pool for executing long-running, blocking operations (AI model loading, heavy computation) without blocking HTTP workers. This feature is inspired by Erlang's dirty schedulers.
11
16
12
17
## Overview
@@ -907,9 +912,40 @@ Dirty Arbiters integrate with the main arbiter's signal handling. Signals are fo
907
912
|`SIGQUIT`| Immediate exit via `sys.exit(0)`| Killed immediately | Fast shutdown, no cleanup |
908
913
|`SIGHUP`| Kills all workers, spawns new ones | Exits immediately | Hot reload of workers |
909
914
|`SIGUSR1`| Reopens log files, forwards to workers | Reopens log files | Log rotation support |
915
+
|`SIGTTIN`| Increases worker count by 1 | N/A | Dynamic scaling up |
916
+
|`SIGTTOU`| Decreases worker count by 1 | N/A | Dynamic scaling down |
910
917
|`SIGCHLD`| Handled by event loop, triggers reap | N/A | Worker death detection |
911
918
|`SIGINT`| Same as SIGTERM | Same as SIGTERM | Ctrl-C handling |
912
919
920
+
### Dynamic Scaling with TTIN/TTOU
921
+
922
+
You can dynamically scale the number of dirty workers at runtime using signals, without restarting gunicorn:
923
+
924
+
```bash
925
+
# Find the dirty arbiter process
926
+
ps aux | grep dirty-arbiter
927
+
# Or use the PID file (location depends on your app name)
928
+
cat /tmp/gunicorn-dirty-myapp.pid
929
+
930
+
# Increase dirty workers by 1
931
+
kill -TTIN <dirty-arbiter-pid>
932
+
933
+
# Decrease dirty workers by 1
934
+
kill -TTOU <dirty-arbiter-pid>
935
+
```
936
+
937
+
**Minimum Worker Constraint:** The dirty arbiter will not decrease below the minimum number of workers required by your app configurations. For example, if you have an app with `workers = 3`, you cannot scale below 3 dirty workers. When this limit is reached, a warning is logged:
0 commit comments