Skip to content

[Conductor] Add KV event manager and HTTP API - #4292

Merged
Chase-Rong merged 4 commits into
kvcache-ai:mainfrom
Misak2333:main
Sep 29, 2026
Merged

Chase-Rong merged 4 commits into
kvcache-ai:mainfrom
Misak2333:main

Conversation

@Misak2333

@Misak2333 Misak2333 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fifth slice of the Mooncake Conductor upstreaming series, on top of the zmq subscriber. Wires the ingest path into the prefix index and exposes the query surface, and produces the mooncake_conductor binary:

  • kvevent/event_manager.{h,cpp}: EventManager owns the indexer, the per-service ZMQ subscribers and the coroutine HTTP server. Start subscribes to every configured service concurrently and reports individual failures through the log rather than failing as a whole, so one unreachable publisher cannot block startup. Stop is idempotent. UnsubscribeFromService stops its ZMQ client outside the manager lock, because the client's loop thread can still be dispatching a batch that needs the manager. Registers five routes: /query, /register, /unregister, /services and /global_view.
  • kvevent/event_handler.cpp: KVEventHandler implements the zmq EventHandler interface for the three publisher protocols, dispatching each batch to per-event handlers that translate into indexer mutations. Mooncake Store publishes one logical hash as several physical objects, such as separate key and value components, so pool_bindings_ tracks the physical set per logical key and only removes the index entry once the last component is gone.
  • Handler lifecycle: MarkUnavailable stops admitting new callbacks and WaitForIdle waits for the ones already admitted, with DispatchLease releasing the in-flight count on every exit path. This is what lets a service be unsubscribed while its subscriber thread is mid-batch.
  • kvevent/config.{h,cpp}: reads the static service list from CONDUCTOR_CONFIG_PATH. A missing file warns and yields an empty list; a malformed file is fatal, since silently serving no cache would be worse than failing to start.
    src/main.cpp: resolves the log level, parses the config, starts the manager and HTTP server, then waits for SIGINT/SIGTERM.
    Two adaptations were needed against the merged common layer, both beyond the mechanical namespace nesting:
    main.cpp consumed a LogLevel enum that no longer exists. [Build] conductor: build skeleton and common layer #3825 replaced it with LogLevelConfig, which already reports glog's own values, so the four-case switch collapses to two assignments.
    Parsing helpers come from mooncake-common rather than being reimplemented: medium normalization uses AsciiToLower (ascii_string.h) instead of a local std::tolower transform, which also drops a locale-sensitive path from a comparison against ASCII literals, and the cache-group check uses TryParseInteger<int64_t> (integer_parser.h). Both substitutions were checked against the previous local implementations over 6470 inputs, including every single byte, the medium spellings the call sites compare against, signed and unsigned int64 boundaries and overflow, embedded NULs, and padded and whitespace-wrapped forms.
    yalantinglibs is guarded with if(NOT TARGET yalantinglibs::yalantinglibs): the top-level build already provides it through mooncake-common, and its config.cmake mutates an imported target owned by the parent scope, so it cannot run twice.

Verified: builds standalone and under the top-level configuration, and conductor_test passes (169 tests across 34 suites, up from 113 across 25).

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake Conductor (mooncake-conductor)
  • Reshard (mooncake-reshard)
  • Mooncake EP (mooncake-ep)
  • Mooncake PG (mooncake-pg)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • Common (mooncake-common)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Performance improvement
  • Other

How Has This Been Tested?

Test commands:

# Example: bash scripts/run_ci_test.sh

Test results:

  • Unit tests pass
  • Integration tests pass (if applicable)
  • Manual testing done (describe below)

Checklist

  • I have performed a self-review of my own code
  • I have formatted my code using ./scripts/code_format.sh
  • I have run pre-commit on the files changed in this PR and all hooks pass
  • I have updated the documentation (if applicable)
  • I have added tests to prove my changes are effective
  • For changes >500 LOC: I have filed an RFC issue

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used (specify below)

Misak2333 and others added 2 commits September 22, 2026 15:41
Fifth slice of the Mooncake Conductor upstreaming series, on top of the zmq
subscriber. Wires the ingest path into the prefix index and exposes the
query surface, and produces the mooncake_conductor binary.

Co-authored-by: Misak2333 <jzxscp173@163.com>
Co-authored-by: Chase-Rong <lolopop.rong@gmail.com>
Accept named LoRA metadata and full-prefix MLA/sink attention events while
retaining context, block-size, group and window guards.

Co-authored-by: Misak2333 <jzxscp173@163.com>
Co-authored-by: Chase-Rong <lolopop.rong@gmail.com>
@Chase-Rong
Chase-Rong self-requested a review September 23, 2026 09:18
@github-actions github-actions Bot added run-ci Mooncake Conductor Changes related to mooncake-conductor labels Sep 23, 2026
Represent cache presence and cumulative query results as npu, cpu_local,
cpu_share, and disk, with a single advancing prefix cursor per rank.
Replace the old gpu/cpu response fields, including rank_matches.

Co-authored-by: Misak2333 <jzxscp173@163.com>
Co-authored-by: Chase-Rong <lolopop.rong@gmail.com>
@Chase-Rong

Copy link
Copy Markdown
Collaborator

Thanks for this slice. The indexer restructuring (four storage tiers with nested cumulative-prefix query semantics), the handler lifecycle design (MarkUnavailable/WaitForIdle/DispatchLease), and the validation strictness are all in good shape, and the test coverage is substantial. I verified the vLLM decode path against vLLM 0.26.0 sources field by field (envelope shape, frame layout, replay protocol, extra_keys shape, medium values, hash projection) and it matches, including the low64 projection direction for both int and bytes hash modes.

… helpers

Extract map lookup and scalar/array parsing into an internal reader shared
by the vLLM, SGLang and Mooncake decoders.

Co-authored-by: Misak2333 <jzxscp173@163.com>
Co-authored-by: Chase-Rong <lolopop.rong@gmail.com>
@Chase-Rong

Copy link
Copy Markdown
Collaborator

LGTM. In the latest commit, an inconsistency caused by sglang changing KVCacheEvent from
array_like=True to omit_defaults=True has been fixed.

@Chase-Rong
Chase-Rong merged commit ef95eb5 into kvcache-ai:main Sep 29, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Mooncake Conductor Changes related to mooncake-conductor run-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants