Hey HN!
I'm excited to share a project I've been working on: Django Protego, a dynamic and configurable Circuit Breaker for Django applications.
What is Django Protego?
Django Protego is a library that helps to protect your services from cascading failures by providing a Circuit Breaker mechanism. It's simple to integrate, dynamic, and works seamlessly with Django-based applications.
Key Features:
- Dynamic Configuration: Configure failure thresholds, reset timeouts, and half-open retries at runtime.
- Global Registry: The circuit breaker state is shared across views via a global registry, ensuring centralized control of your application’s fault tolerance.
- Easy to Use: Just decorate your views with @protego.protect to wrap your views in the circuit breaker logic.
- Flexible: Supports multiple circuit breakers in the same project, all configurable independently.
- In-Memory: Implements a highly efficient in-memory circuit breaker with no external dependencies.
How It Works:
- Protego Client: For each service, the circuit breaker maintains its state (open, closed, half-open) and tracks failures.
- Thresholds and Timeout: You can dynamically adjust failure thresholds, reset timeouts, and half-open retries via a central configuration in your Django app.
- Global Access: Protego ensures that circuit breakers are initialized once and are accessible globally in your project.
- Graceful Failures: When the circuit breaker is "open", instead of hitting the service, it automatically returns a failure response (e.g., 503 Service Unavailable).
Future Roadmap for Protego Circuit Breaker
To further enhance Protego and make it even more powerful and scalable, here's a roadmap that focuses on integrating it with Django, Redis, and databases for advanced fault tolerance, persistence, and distributed systems.
Link: https://github.com/grandimam/django-protego