pyrtshm
pyrtshm is a real-time distributed shared memory implemented in python over UDP protocol using protobuf.
It is intended to be used as a dict that mirrors its keys and values across distributed nodes in environments that can tolerate packet losses, but need real time updates. For example, games backend, live stream of stock prices, machine discovery and monitoring, etc.
To give a simple example, think of 2 hosts running your project, node-1
and node-2. In node-1 you have:
mem = SharedMemory(listen=('0.0.0.0', 3333), forward_nodes=[('node-2', 3333)])
mem.start()
In node-2, you have:
mem = SharedMemory(listen=('0.0.0.0', 3333), forward_nodes=[('node-1', 3333)])
mem.start()
Now, if you set any key in one of the nodes like this:
mem["my-key"] = 1
In almost real time, with high thoughput, mem["my-key"] will have value
1 in the other node. You can add as many nodes as needed in the
forward_nodes list.
Install it from PyPI
pip install pyrtshm
Usage
from pyrtshm import SharedMemory
# Each node initializes itself by indicating its own port, and the
# host & sport of the other nodes (the "forward nodes").
other_nodes = [('host1', 3333), ('host2', 3333), ('host3', 3333)]
mem = SharedMemory(listen=('0.0.0.0', 3333), forward_nodes=other_nodes)
mem.start()
# Set a key, making it available to other nodes.
mem["host1/cpu"] = 75.1
# Get a key set by another node.
avg_cpu = mem["host1/cpu"] + mem["host2/cpu"]
# Deletes a key locally and to the other nodes
del mem["host0/cpu"]
Development
Read the CONTRIBUTING.md file.
Metadata
Release files for pyrtshm 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyrtshm-0.0.4.tar.gz | 17.1 kB | Without provenance | Details for pyrtshm-0.0.4.tar.gz |
Release files / pyrtshm-0.0.4.tar.gz
| Download URL | pyrtshm-0.0.4.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da893b5903464d037d488de3204448effaa0c2daf2e7a891935f490b1574de79
|
|
BLAKE2b-256 checksum How to use checksums |
b8cc010620972074708f99cbfdd15fd6b082333041fcb5478533009b90d58565
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
|
Security for pyrtshm 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.