Repository navigation
fix(umbp): count SSD keys without snapshotting them - #808
Merged
Merged
Conversation
SsdBackend::OwnedKeyCount() built a vector of every owned key under PeerSsdManager::mutex_ just to return its size. A masterless node's metrics loop calls it every second (the master heartbeat does too), so with ~1.2M SSD keys every per-key Exists, read and commit on the SSD tier stalled ~145 ms once a second. In a DRAM+SSD weighted tier that made scheduler lookups 4-16 ms instead of ~2.7 ms. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SsdBackend::OwnedKeyCount()built astd::vector<KvEvent>of every key the SSD tier owns, underPeerSsdManager::mutex_, and returned only its.size().Several loops call it:
PoolClient::PublishNodeStateGauges) every second.With ~1.2M SSD keys, each call held the mutex ~145 ms. Everything on the SSD tier waits on that mutex: per-key
Exists(the defaultBatchContainstakes it once per key),PrepareReadBatchand commits. So once a second the SSD tier stalled for ~145 ms.In a DRAM+SSD weighted tier (one standalone server, DEP c384 DSv4-Pro), this made sglang's scheduler lookups ~16 ms instead of P0's ~2.7 ms, growing with the SSD key count.
PageBackend::OwnedKeyCount()is already justowned_.size(), so DRAM-only deployments never saw it.Fix
PeerSsdManager::OwnedKeyCount()returnsowned_.size()under the lock.SsdBackend::OwnedKeyCount()uses it. The snapshot has exactly one entry perowned_element, so the count is unchanged.How it was found
On a live e2e arm, a side client inside the container probed exists (32 keys every 0.2 s). Every ~2.3 s a call stalled 70–165 ms; back-to-back calls stayed ~1 ms.
perf schedshowed one server thread waking every 1000 ms and running ~145 ms on the CPU.perf record -ton that thread:PeerSsdManager::SnapshotOwnedKeysLockedplusmalloc.Benchmark
Standalone server, mixed tier (DRAM 64 GB : SSD 200 GB, weights 423:1000), seeded with 1.5M 4 KiB objects (1.05M on SSD). The server is otherwise idle, and exists is probed on 32 random keys with 0.2 s gaps. Two interleaved runs each:
Tests
UMBP ctest (gfx950 build): 55/55.
umbp_pool_client_rangesandumbp_cross_node_smokeaborted under-j 8(RDMA device contention) and passed when rerun serially.🤖 Generated with Claude Code