Open-source NGINX module providing adaptive circuit breaker behavior using real-time upstream error rates.

Hi everyone,

I’ve been working on an open-source NGINX dynamic module called Traction Control Module, designed to protect upstream services from overload and cascading failures.

Unlike traditional rate limiting, the module continuously evaluates upstream health using a sliding-window error rate and automatically adjusts traffic handling based on observed service degradation.

The module transitions through multiple states:

Normal → Warning → Critical (429) → Emergency (503) → Recovery

Features:

• Lock-free atomic counters
• Shared memory across workers
• Independent zones per service/upstream
• Sliding-window health scoring
• Progressive traffic shedding
• Native NGINX phase integration
• Monitoring endpoint

Example use cases:

• Protecting APIs during partial outages
• Preventing cascading failures
• Reducing retry storms
• Graceful degradation of overloaded services

Example configuration:

location /api {
traction_control zone=backend;
traction_warning_action rate_limit=30%;
proxy_pass http://upstream;
}

The goal is not to replace limit_req or upstream health checks, but to provide adaptive protection based on real-time error rates observed by NGINX.

The project is currently in beta and I’d appreciate feedback from the community, especially regarding architecture, operational behavior, and real-world use cases.

GitHub:

Feedback and suggestions are welcome.

Best regards,

Alessandro Silveira