[SPARK-55751][SS] Add metrics on state store loads from cloud storage#54567
Open
gnanda wants to merge 2 commits intoapache:masterfrom
Open
[SPARK-55751][SS] Add metrics on state store loads from cloud storage#54567gnanda wants to merge 2 commits intoapache:masterfrom
gnanda wants to merge 2 commits intoapache:masterfrom
Conversation
761843b to
b36d880
Compare
b36d880 to
910b000
Compare
ericm-db
reviewed
Mar 2, 2026
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala
Outdated
Show resolved
Hide resolved
65f059f to
22cd93d
Compare
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.
What changes were proposed in this pull request?
This PR adds a new metric, rocksdbLoadedFromCloud, that tracks how many times the RocksDB state store fetched a snapshot from remote (cloud/DFS) storage during a single load operation.
The implementation introduces a fetchCheckpointFromDfs helper in RocksDB that centralizes all fileManager.loadCheckpointFromDfs(...) call sites. Each call through this helper increments a per-load numCloudLoads counter, which is then emitted
via loadMetrics (under both the load and loadFromSnapshot paths). The counter is reset at the start of each load.
The metric is surfaced as a StateStoreCustomSumMetric named rocksdbLoadedFromCloud and included in the full list of custom metrics reported by RocksDBStateStoreProvider.
Why are the changes needed?
Fetching state from cloud storage is significantly more expensive than a local cache hit. Without this metric, there is no way to distinguish a load that was fully served from local disk from one that required one or more round-trips to cloud
storage. This metric gives operators and developers visibility into cloud load frequency, which is useful for diagnosing performance regressions, tuning snapshot and changelog checkpointing configuration, and understanding cost implications of
state store operations.
Does this PR introduce any user-facing change?
Yes. A new custom metric rocksdbLoadedFromCloud ("RocksDB: load - number of times state was loaded from cloud storage") is now reported in the Structured Streaming progress reporter under stateOperatorMetrics.customMetrics.
How was this patch tested?
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code 2.1.58