A python implementation of redlock, with examples
Project description
Use cases
- Got a script that you want to be able to run multiple instances of in parallel?
- Want to write a program from scratch that's ready to scale up?
- Using someone else's code that has race conditions and want to singleton-ize it?
Intro
Hungry Hungry Hippos, (HHH) is a python implementation of redlock https://redis.io/topics/distlock with a set of examples that use docker, redis and docker compose. The advantage of this approch, compared to multithreading, is that is can be applied in a single-threaded context (for example if you have to integrate existing code), or in a mutliple container instance context (think microservices)
Features
- atomic locking guarantees single lock acquisition
- works across machines / containers
- handles dead lock recovery
- can wrap existing code for cases when you cannot or do not want to do a rewrite.
Key concepts
- Process isolation
- Destributed locks (see https://redis.io/topics/distlock)
- Command orchestration
Toolchain
- docker - images, containers, volumes
- docker-compose - building, linking services, scaling services
- redis - in memory key-value database
Installation
pip install hungry-hungry-hippos
See examples for use cases
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hungry_hungry_hippos-1.0.tar.gz
.
File metadata
- Download URL: hungry_hungry_hippos-1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 504fc229a22d0fc2ccadf0574d114f4b2950cfbebd31c8551b6b88ede2cc2436 |
|
MD5 | df14aee9c595e42f766caa40b749099b |
|
BLAKE2b-256 | fee73b59401ccb3e85606119abc2589e5842aa8296ff2875cc61eeb249d44f1b |
File details
Details for the file hungry_hungry_hippos-1.0-py3-none-any.whl
.
File metadata
- Download URL: hungry_hungry_hippos-1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9174dcccb489dc8484ff76162d8912b9bf020d3de0e48dc58aaf0ade7d558030 |
|
MD5 | efb76dc4a6d32c355ec10f8cf5778b6d |
|
BLAKE2b-256 | 29551b80668ba3f9cca17233de3a8a687a4378e6fbd47cfcfe78c6f9dbff2fc7 |