Skip to content

Commit 56b448a

Browse files
authored
feat(kv-indexer): add python launcher follow-up [DYN-2459] (#7395)
Signed-off-by: PeaBrane <yanrpei@gmail.com>
1 parent 7b941d7 commit 56b448a

File tree

18 files changed

+899
-157
lines changed

18 files changed

+899
-157
lines changed

Cargo.lock

Lines changed: 54 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

container/templates/wheel_builder.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,9 @@ RUN --mount=type=secret,id=aws-key-id,env=AWS_ACCESS_KEY_ID \
439439
uv build --wheel --out-dir /opt/dynamo/dist && \
440440
cd /opt/dynamo/lib/bindings/python && \
441441
if [ "$ENABLE_MEDIA_FFMPEG" = "true" ]; then \
442-
maturin build --release --features "media-ffmpeg" --out /opt/dynamo/dist; \
442+
maturin build --release --features "media-ffmpeg,kv-indexer,kv-indexer-runtime" --out /opt/dynamo/dist; \
443443
else \
444-
maturin build --release --out /opt/dynamo/dist; \
444+
maturin build --release --features "kv-indexer,kv-indexer-runtime" --out /opt/dynamo/dist; \
445445
fi && \
446446
/tmp/use-sccache.sh show-stats "Dynamo Runtime"
447447

docs/components/router/standalone-indexer.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ subtitle: Run the KV cache indexer as an independent HTTP service for querying b
99

1010
The standalone KV indexer (`python -m dynamo.indexer`) is a lightweight service that maintains a radix tree of cached blocks and exposes HTTP endpoints for querying and managing workers. It supports two operational modes:
1111

12-
- **Standalone mode** (default): subscribes to ZMQ KV event streams directly from workers. No Dynamo runtime dependencies required.
12+
- **Standalone mode** (default): subscribes to ZMQ KV event streams directly from workers. No Dynamo runtime discovery, registration, or event-plane integration required.
1313
- **Dynamo runtime mode** (`--dynamo-runtime`): integrates with the Dynamo runtime for automatic worker discovery via MDC, KV event ingestion via the event plane (NATS or ZMQ), and overlap queries over the request plane for remote frontends.
1414

1515
This is distinct from the [Standalone Router](../../../components/src/dynamo/router/README.md), which is a full routing service. The standalone indexer provides only the indexing and query layer without routing logic.
@@ -44,11 +44,11 @@ Multiple indexer replicas can subscribe to the same ZMQ worker endpoints for fau
4444

4545
### How It Works
4646

47-
1. Workers are registered via `--workers` CLI, which connects ZMQ SUB sockets immediately.
48-
2. A 1-second delay ensures the peer's tree state has advanced past the ZMQ connection point, so the dump covers any events that would otherwise be lost to the slow-joiner window.
47+
1. Workers are registered via `--workers` or `/register`. Each ZMQ listener enters `pending` state and begins its initial subscribe/connect attempt in the background.
48+
2. A 1-second delay biases peer recovery past the slow-joiner window, so the dump covers events that may have occurred before a fresh listener can safely start draining.
4949
3. The indexer fetches a `/dump` from the first reachable peer in `--peers`.
5050
4. Dump events are applied to populate the radix tree.
51-
5. ZMQ listeners are unblocked and begin draining any events that buffered during recovery.
51+
5. After recovery completes, the ready gate opens. Any listener whose initial ZMQ connect has already succeeded transitions to `active` and begins draining buffered events; listeners for workers that are still down remain `pending` until they connect.
5252

5353
If no peers are reachable, the indexer starts with an empty state.
5454

@@ -81,11 +81,11 @@ Peers can be registered at startup via `--peers` or dynamically via the HTTP API
8181

8282
## Building
8383

84-
The service is exposed through the Python package after building the bindings with maturin. Feature flags control which capabilities are compiled in:
84+
The service is exposed through the Python bindings package and launched with `python -m dynamo.indexer` after building the bindings with maturin. Feature flags control which capabilities are compiled in:
8585

8686
| Feature | Description |
8787
|---------|-------------|
88-
| `kv-indexer` | Core standalone indexer binary (HTTP API, ZMQ listeners, P2P recovery) |
88+
| `kv-indexer` | Core standalone indexer service path (`python -m dynamo.indexer`: HTTP API, ZMQ listeners, P2P recovery) |
8989
| `kv-indexer-metrics` | Optional `/metrics` endpoint |
9090
| `kv-indexer-runtime` | Dynamo runtime integration (`--dynamo-runtime`, discovery, event plane, request plane) |
9191

@@ -155,7 +155,7 @@ curl http://localhost:8090/health
155155

156156
### `GET /metrics` — Prometheus metrics
157157

158-
Returns metrics in Prometheus text exposition format. Available when the binary is built with the `kv-indexer-metrics` or `kv-indexer-runtime` feature.
158+
Returns metrics in Prometheus text exposition format. Available when the Python bindings are built with the `kv-indexer-metrics` or `kv-indexer-runtime` feature.
159159

160160
```bash
161161
curl http://localhost:8090/metrics

0 commit comments

Comments
 (0)