Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roma-glushko/hyx
π§ββοΈ Lightweight fault tolerant primitives for your modern asyncio Python microservices
https://github.com/roma-glushko/hyx
asyncio chaos-engineering circuit-breaker distributed-systems high-availability python3 resilience stability-patterns
Last synced: 3 months ago
JSON representation
π§ββοΈ Lightweight fault tolerant primitives for your modern asyncio Python microservices
- Host: GitHub
- URL: https://github.com/roma-glushko/hyx
- Owner: roma-glushko
- License: apache-2.0
- Created: 2022-12-09T09:45:38.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-10T17:26:41.000Z (about 1 year ago)
- Last Synced: 2024-03-14T15:26:29.400Z (10 months ago)
- Topics: asyncio, chaos-engineering, circuit-breaker, distributed-systems, high-availability, python3, resilience, stability-patterns
- Language: Python
- Homepage: https://hyx.readthedocs.io/en/latest/
- Size: 236 KB
- Stars: 54
- Watchers: 3
- Forks: 5
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
- Roadmap: docs/roadmap.md
Awesome Lists containing this project
- awesome-distributed-system-projects - Hyx - Lightweight fault tolerance primitives for your resilient and modern Python microservices
README
π§ββοΈοΈLightweight fault tolerance primitives for your resilient and modern Python microservices
---
**Hyx** (/ΛhΚΙͺx/) is a set of well-known stability patterns that are commonly needed
when you build [microservice-based](https://en.wikipedia.org/wiki/Microservices) applications.
Hyx is meant to be [Hystrix (Java)](https://github.com/Netflix/Hystrix), [resilience4j (Java)](https://github.com/resilience4j/resilience4j) or [Polly (C#)](https://github.com/App-vNext/Polly) but for the Python world.## Key Features
- Implements five commonly used resiliency patterns with various configurations based on advice and experience of industry leaders (e.g. AWS, Google, Netflix)
- Idiomatic Pythonic implementation based on [decorators](https://realpython.com/primer-on-python-decorators) and [context managers](https://realpython.com/python-with-statement)
- [AsyncIO](https://docs.python.org/3/library/asyncio.html) Native Implementation
- Lightweight. Readable Codebase. High Test Coverage## Requirements
- Python 3.9+
- AsyncIO-powered applications ([no sync support?](https://hyx.readthedocs.io/en/latest/faq/#no-sync-support))## Installation
Hyx can be installed from [PyPi](https://pypi.org/project/hyx):
``` sh
pip install hyx# or via poetry
poetry add hyx
```## Component Map
| Component | Problem | Solution | Implemented? |
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
| π Retry | The failures happen sometimes, but they self-recover after a short time | Automatically retry operation on temporary failures | β |
| πΎ Cache | | | |
| β‘οΈ Circuit Breaker | When downstream microservices have got overloaded, sending even more load can make the situation only worse. | Stop doing requests to your failing microservice temporarily if amount of errors exceeded expected thresholds. Then see if the given time helped the microservice to recover | β |
| β± Timeout | Sometimes operations may take too much time. We cannot wait that long or after that time the success is unlikely | Bound waiting to a reasonable amount of time | β |
| π° Bulkhead | If executed without control, some code can take too much resources and put down the whole application (and upstream services) or cause slowness of other places of the application | Fix the amount of calls to the code, queue other calls and fail calls that goes beyond your capacity | β |
| πββοΈ Rate Limiter | The microservice can be requested with any rate even one that can put it down if happens by accident | Limit the rate your system can be accessed by | β |
| π€ Fallback | Nothing can guarantee you that your dependencies will work. What would you do when it's failing? | Degrade gracefully by defining some default values or placeholders if your dependencies are down | β |
Inspired by Polly's Resiliency Policies## Acknowledgements
- [resilience4j/resilience4j](https://github.com/resilience4j/resilience4j)
- [Netflix/Hystrix](https://github.com/Netflix/Hystrix)
- [slok/goresilience](https://github.com/slok/goresilience)
- [App-vNext/Polly](https://github.com/App-vNext/Polly)
- [Diplomatiq/resily](https://github.com/Diplomatiq/resily)