mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #4396] [RFC]: [Store] Client Configuration Normalization and Validation Pipeline #1107
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1107
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Aionw on GitHub (Sep 29, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4396
Changes proposed
Context and goal
A Mooncake Store client is configured through several unrelated input paths, and each path resolves, defaults and validates settings on its own.
MooncakeDistributedStore.setup(...)positional args (store_py.cpp)ipc_socket_path, local RPC port50052andstart_offload_rpc_server=truehard-coded downstreamsetup(dict)(ConfigDict)get_config*helpers inreal_client.cppinit_all(...)/mooncake_store_init_alllocalhost:12345, metadata127.0.0.1:2379and a 1 GiB buffer hard-codedmooncake_store_setupmooncake_clientbinary (real_client_main.cpp)--enable_http_server/--http_portdefined inreal_client.cpp, which therefore also apply in-process for pybindMooncakeConfig(MOONCAKE_CONFIG_PATHJSON orMOONCAKE_*env)On top of that, components below
RealClientread their own settings directly from the process environment at construction, at first use, or on every call (Environ::Process(), ~50 production call sites after #4388).This causes three problems:
50052everywhere except the binary.MC_CXL_DEV_SIZEis fatal only after the client is created and its buffer registered;FileStorageConfigand the storage backend configs throw only while offload initializes.Goal: normalize every external client input into one typed
ClientConfig, validate it once before any component is created, and construct the client from it. Components will then receive their part of the config from their parent instead of reading external sources.This follows the direction of #3809 (environment convergence) and #4360 (component-owned configuration, resolved once at startup) for the client side. #4360 covers the master.
Pipeline
ClientConfig:FromSetupArgs,FromConfigDict,FromCommandLine, and the C API. Adapters only translate; they don't validate or start anything. Environment-backed sub-configs come from the existingXxxConfig::FromEnvironment(Environ::Process())loaders, using the per-process catalogClientEnvironmentVariables(#4392).ClientConfig::Validate()runs every check in one place: per-field checks, cross-field checks such as "protocolcxlrequires a CXL device size", and the existingValidate()of each sub-config. It returns an error before anything is created. Every entry point goes through it.RealClient::Setup(const ClientConfig&)becomes the single setup path. The existing positional, dict,init_all, C API and binary entry points become thin wrappers that normalize, validate and then call it.RealClientandClientpass sub-configs to the components they create, so the remainingEnviron::Process()reads under the client are removed one component subtree at a time.ClientConfigshapeThe top-level groups mirror
ClientEnvironmentVariablesfrom #4392, so each setting has one owner group:Sub-configs reuse the existing typed config structs under
mooncake-store/src/config, so no new parsing logic is introduced.Precedence contract
This RFC does not change precedence. Where more than one source feeds a setting, the adapter reproduces the current effective order, and a test pins it. The known overlaps are:
MOONCAKE_OFFLOAD_FILE_STORAGE_PATH> default--enable_http_server; port = arg if arg-enabled, else--http_portMC_MS_AUTO_DISC> (protocol rdma/efa and no device → on); filters only when onMOONCAKE_HOST_ID> normalizedlocal_hostnamelocal_hostnamedisables the auto-port range--port; other entry points50052(now an explicitClientConfigdefault)MC_DISABLE_MMAP_ARENAwins; enabled = flag OR pool-size env; env size > flag sizeMooncakeConfigMOONCAKE_CONFIG_PATH, else env)Any change to precedence or defaults requires a separate proposal, consistent with #3809 and #4360.
Behavior changes
The only intended changes are in when validation happens and which entry points run it. They are listed in each PR description:
Earlier failure. Invalid inputs now fail before the client connects to the master or registers memory:
The conditions and error codes stay the same. Only the point of failure moves earlier.
Uniform checks. Segment-size limits, which today only the dict path enforces, apply to every entry point.
Out of scope
ResolveXConfigowners, default → file → explicit CLI).Clientand talks to the real client over RPC; it can adopt the same pattern later.fsdir, disk eviction, quota). They aren't startup inputs and stay where they are.Process-wide state
Several client settings are consumed by process-wide singletons or caches:
ShmHelper,SpdkWrapperand the registered pinned-memory manager;call_oncemmap arena;Because of these, two
RealClientinstances in one process already cannot use different values for those settings.ClientConfigkeeps them in their groups, but the follow-up distribution PRs mark them process-scoped. Those PRs initialize them once from the first validated config and log a warning if a later config differs, rather than silently ignoring it. Moving them to per-instance ownership is out of scope.Delivery plan
Each step is its own PR, stacked on the previous one, with no behavior change beyond the validation timing listed above.
Entry normalization and validation (client). This step:
ClientConfigwithValidate();RealClient::Setup(const ClientConfig&);Components are not changed yet. Because
Environ::Process()snapshots the environment on first read (#4388), the values validated at the entry are the same values the components read later.Distribute: offload subtree.
FileStorageandCreateStorageBackendreceiveoffloadinstead of reading Bucket / FilePerKey / OffsetAllocator / DFS / OSS / NVMe-KV environment settings. This also removes the per-call NVMe-KV reads.Distribute: transfer subtree.
TransferSubmitter, the worker pools and NoF.Distribute: memory and master-connection subtrees.
MasterClientpool config and replica selection. These are currently read inline in headers.RealClient/Clientreads.When step 4 is done, no component under the client reads external configuration directly.
Relationship to existing work
FLAGS_*or environment lookups.Open questions
ClientConfiglive undermooncake-store/include/config(public to pybind and the C API) or be split into a public input struct and a private resolved struct?Before submitting a new issue...
@github-actions[bot] commented on GitHub (Sep 29, 2026):
Thanks for opening this issue, @Aionw!
41376987A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide