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: about 2 months ago
JSON representation

πŸ§˜β€β™€οΈ Lightweight fault tolerant primitives for your modern asyncio Python microservices

Lists

README

        


Hyx



πŸ§˜β€β™‚οΈοΈLightweight fault tolerance primitives for your resilient and modern Python microservices




Package Version


Downloads


Supported Python Versions


Discord



Documentation Status



Test Status


Coverage

---

**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)