Repository navigation
[Store] Prevent object_already_exists log storm - #4285
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Fix the missing comma so the Grafana dashboard is valid JSON.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR reduces Mooncake Store log storms by replacing duplicate-object logs with Prometheus counters and Grafana visibility.
Changes:
- Adds duplicate
PutStartandBatchPutStartcounters. - Removes noisy duplicate logs and adds regression tests.
- Updates the Grafana dashboard.
| File | Summary |
|---|---|
mooncake-store/tests/master_metrics_test.cpp |
Tests counter behavior and log suppression. |
mooncake-store/src/rpc_service.cpp |
Records duplicate responses. |
mooncake-store/src/master_service.cpp |
Removes duplicate logs. |
mooncake-store/src/master_metric_manager.cpp |
Implements metrics. |
mooncake-store/include/master_metric_manager.h |
Declares metrics and accessors. |
monitoring/grafana/dashboards/mooncake.json |
Adds metric panels; currently has invalid JSON due to a missing comma. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
d01c8aa to
7c8b051
Compare
he-yufeng
left a comment
There was a problem hiding this comment.
Verified the whole path against the PR head. The storm source is exactly where the fix lands, and the counting is wired correctly:
All four per-key LOG(INFO) ... object_already_exists sites in master_service.cpp (two in InsertMetadata, one in AllocateAndInsertMetadata, one in the PutStart discard check) are gone — the file goes from 4 to 0. The single-put counter increments at one point, the WrappedMasterService::PutStart wrapper on an OBJECT_ALREADY_EXISTS result, so every service-side producer funnels through it. The batch path replaces the per-item VLOG(1) with an already_exists_count accumulated in the result loop and one inc_batch_put_start_object_already_exists call after the join, which keeps the per-item semantics the old messages had without paying per-item log cost. The counters themselves follow the manager's existing patterns (zero-initialized in update_metrics_for_zero_output, getters, serialized names in the tests).
Coverage boundary, checked method by method: the remaining producers of OBJECT_ALREADY_EXISTS are UpsertStart (line ~5766), CopyStart (~6450), and the standby-restore paths (~3640/3790). The restore paths are startup recovery, not a rate path. Upsert overwrites by design and CopyStart is not the SGLang-resume storm shape, so scoping the counters to PutStart/BatchPutStart matches the described incident; if an operator ever sees those two storm, the same wrapper pattern applies one-for-one. Worth one line in the PR description that the scope decision is deliberate.
Tests cover zero-init and metric-name serialization for both counters plus the log-sink suppression case, and CI is green (21 success, the 2 skips are the usual scope detects).
Verification scope, honestly: this is a source-level review of the mechanism and the counting semantics; I did not run a local build of the new metric tests and rely on the PR's suite plus CI for that.

Description
Repeated writes to existing objects can flood the master logs with
object_already_existsmessages. For example, when SGLang resumes using Mooncake as its L3 backend after temporarily unavailability.Replace the per-key INFO logs and duplicate-specific batch VLOG messages with separate Prometheus counters for PutStart requests and BatchPutStart items. Display both counters in existing Grafana panels.
Module
mooncake-transfer-engine)mooncake-store)mooncake-conductor)mooncake-reshard)mooncake-ep)mooncake-pg)mooncake-integration)mooncake-p2p-store)mooncake-wheel)mooncake-common)mooncake-rl)Type of Change
How Has This Been Tested?
Built and ran the initial-counter and duplicate-log regression tests in an ARM64 Linux container with GCC 13. Both passed, covering single and batch duplicates, mixed batches, counter isolation and log suppression.
Test commands:
Test results:
Tested locally with 100+ clients generating up to 1,000 OBJECT_ALREADY_EXISTS responses per minute.
Checklist
./scripts/code_format.shAI Assistance Disclosure
Codex assisted with repo discovery and tests