Chu Cheng Li created HDDS-13352:
-----------------------------------

             Summary: Shared RocksDB Iterator Cache for Paginated List Requests
                 Key: HDDS-13352
                 URL: https://issues.apache.org/jira/browse/HDDS-13352
             Project: Apache Ozone
          Issue Type: Improvement
            Reporter: Chu Cheng Li


*Background*
The Ozone Manager (OM) creates a new RocksDB iterator for every page of a list 
request (keys, buckets, volumes). For large listings, this repeats iterator 
initialization and {{seek()}} overhead on every page.

*Proposal*
Introduce an iterator-cache layer inside OM:
 # *Iterator Pool* – Maintain an LRU-K map of active RocksDB iterators keyed by 
a generated iterator ID included in the continuation token.

 # *Single Ownership* – When a page request pulls an iterator from the pool, 
mark it “in-use” to prevent concurrent access; return it to the pool after the 
page is produced.

 # *Eviction Controls* –

 ** {*}TTL{*}: close and discard iterators idle longer than _N_ seconds.

 ** {*}Size Limit{*}: cap the pool to _K_ iterators; evict the 
least-recently-used beyond the limit.

 # *Fallback* – If the iterator is missing or expired, create a fresh iterator 
and continue from the provided marker (current behavior).

 # *Snapshot Consistency* – Each cached iterator is tied to the snapshot 
created for the first page, ensuring all pages in the same listing see a 
consistent view.

*Benefits*
 * Cuts per-page latency and CPU usage by avoiding repeated iterator 
construction.

 * Reduces RocksDB index/data block loads for long listings.

 * Preserves “read-your-own-listing” consistency across pages.

*Prior Art / Inspiration*
 * HBase server-side scanners with lease timeout.

 * MongoDB cursors (10-minute idle timeout).

 * MinIO list-objects metadata cache.

*Acceptance Criteria*
 * Config flags {{{}om.iterator.cache.enabled{}}}, 
{{{}om.iterator.cache.size{}}}, {{{}om.iterator.cache.ttl{}}}.

 * Stress tests show measurable speed-up (e.g., ≥ 30 % latency reduction for 1 
M-key listings over 10 pages).

 * No concurrency violations (iterator reused by multiple threads).

 * Snapshot pinning does not block compaction beyond configured TTL.

*Out of Scope*
 * Per-client isolation or quota management.

 * API changes on the client side (token format remains opaque).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to