Skip to content

feat(dirty): add TTIN/TTOU signal support for dynamic worker scaling#3504

Merged
benoitc merged 4 commits into
masterfrom
feature/dirty-ttin-ttou
Feb 12, 2026
Merged

feat(dirty): add TTIN/TTOU signal support for dynamic worker scaling#3504
benoitc merged 4 commits into
masterfrom
feature/dirty-ttin-ttou

Conversation

@benoitc
Copy link
Copy Markdown
Owner

@benoitc benoitc commented Feb 12, 2026

Summary

  • Add SIGTTIN/SIGTTOU signal support to dirty arbiters for dynamic worker scaling
  • Allows scaling dirty workers up/down at runtime without restarting gunicorn
  • Respects minimum worker constraints from app configurations

Changes

  • Add num_workers instance variable for dynamic count
  • Add _get_minimum_workers() to calculate minimum required workers from app specs
  • Add signal handlers for TTIN (increase) and TTOU (decrease)
  • Update manage_workers() to use dynamic count instead of config
  • Add documentation for dynamic scaling in dirty.md
  • Add unit tests (17 tests)
  • Add Docker integration tests

Usage

# Find the dirty arbiter process
ps aux | grep dirty-arbiter

# Increase workers
kill -TTIN <dirty-arbiter-pid>

# Decrease workers
kill -TTOU <dirty-arbiter-pid>

Minimum Worker Constraint

The dirty arbiter will not decrease below the minimum workers required by app configurations. For example, if an app has workers = 3, you cannot scale below 3 dirty workers.

WARNING: SIGTTOU: Cannot decrease below 3 workers (required by app specs)

Closes #3489

New Features:
- Dirty Stash: global shared state between workers (#3503)
- Dirty Binary Protocol: TLV encoding for efficient IPC (#3500)

Documentation:
- Fix Markdown formatting in /configure
- Remove beta warning from ASGI worker documentation
- Add beta warning to Dirty Arbiters documentation
- Update README feature list accordingly
- Update changelog to reflect stability changes
Add support for SIGTTIN and SIGTTOU signals to the dirty arbiter,
allowing dynamic scaling of dirty workers at runtime without restarting
gunicorn.

Changes:
- Add TTIN/TTOU to DirtyArbiter.SIGNALS
- Add num_workers instance variable for dynamic count
- Add _get_minimum_workers() to enforce app worker constraints
- Add signal handlers for TTIN (increase) and TTOU (decrease)
- Update manage_workers() to use dynamic count
- Add documentation for dynamic scaling
- Add unit tests for signal handling
- Add Docker integration tests

The minimum worker constraint ensures TTOU cannot reduce workers below
what apps require (e.g., if an app has workers=3, minimum is 3).

Closes #3489
@benoitc benoitc merged commit 3cba17b into master Feb 12, 2026
33 of 34 checks passed

"""Gunicorn configuration for TTIN/TTOU testing."""

bind = "0.0.0.0:8000"

This comment was marked as resolved.

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

h2c support

2 participants