ds-service: An in-memory data structure server
ds-service is a small, in-memory data structure server
that is accessible via gRPC.
ds-service runs a single server process
that holds shared state in memory
and lets many distributed clients and workers coordinate using it.
Use it when several processes need to hand work to each other.
The processes run on one machine or across a cluster.
It covers four cases:
- The processes hand work to each other.
- The processes share intermediate results.
- The processes take turns on a resource.
- The processes agree on a number.
The state only has to live as long as the run does.
Presently, it provides six data structures: a key-value store, a task queue, a journal store, a time series store, named mutexes, and counters. Each is a separate key space with its own set of RPCs, described in the data structure reference.
Installation
The server is a single statically linked binary.
Download the latest release, make it executable,
and put it somewhere on your PATH:
curl -sSL -o ds-service \
https://github.com/parantapa/ds-service/releases/latest/download/ds-service
chmod +x ds-service
It links against musl with no dynamic dependencies, so it runs on any x86-64 Linux host.
The Python client comes from PyPI:
pip install ds-service-client
To build the server from source instead, see how to build the server.
Usage
Start a server:
ds-service --address 127.0.0.1:5051
Then, from any process that can reach it:
from ds_service_client import DsServiceClient
with DsServiceClient("127.0.0.1:5051") as client:
client.map_set("greeting", b"hello")
assert client.map_get("greeting") == b"hello"
client.task_add("job-1", queue="work", priority=1.0, function=b"greet", input=b"world")
task = client.task_get(worker_id="worker-a", queue="work")
client.task_done(task.task_id, worker_id="worker-a", output=b"hello world")
assert client.task_get_output("job-1") == b"hello world"
Documentation
| Document | What it covers |
|---|---|
| Tutorial: run your first tasks through ds-service | Start a server, store a value, and take a task from Ready to Complete. Start here. |
| How to build the ds-service server | Requirements, the Conan and CMake build, how to install and run the binary, and the static musl build. |
| How to write a worker | The claim-work-report loop, mutexes around shared resources, progress reporting, and the asyncio variant. |
| Data structure reference | Every RPC, its arguments and error statuses, and the exact semantics of each data structure. |
| Python client reference | DsServiceClient and DsServiceClientAsync: constructors, method names, the mapping from a gRPC status to an exception, and examples. |
| Server helper reference | DsServiceServer, which runs a private ds-service process for the life of the object. |
| About the architecture | The three pieces, why the server does not persist state, one lock per structure, and why there are two Python clients. |
| About the task queue | Task ownership, what canceling does and does not do, and why there is no fault tolerance. |
| About the static musl build | Why the static image exists and why its Conan profile differs. |
License
MIT. See LICENSE.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ds_service_client-5.2.0.tar.gz.
File metadata
- Download URL: ds_service_client-5.2.0.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4541073b125bb8261e86147a07c06047edde4f45adf73441e34b63391178594b
|
|
| MD5 |
6fe7cbc6d7467285829864c993ecfb10
|
|
| BLAKE2b-256 |
c50c2de398a33682e981aa0c0e1ba0634433e4db0abfbeba9b03720a886023ce
|
File details
Details for the file ds_service_client-5.2.0-py3-none-any.whl.
File metadata
- Download URL: ds_service_client-5.2.0-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14e9ce0f0d9da5ec826ba3efe16290b67c2dad104a21fc01b1cd5c4e897c50d6
|
|
| MD5 |
34c10f518614a315dd777b3236c0d867
|
|
| BLAKE2b-256 |
75ba1b6335b945480a0d6d44078ebdec73b7f5c7839e109037f3e6d132f4a941
|