feat: Optimize Nimble metadata IO with MetadataCache and pinned caching (#16948)#16948
Closed
xiaoxmeng wants to merge 1 commit intofacebookincubator:mainfrom
Closed
feat: Optimize Nimble metadata IO with MetadataCache and pinned caching (#16948)#16948xiaoxmeng wants to merge 1 commit intofacebookincubator:mainfrom
xiaoxmeng wants to merge 1 commit intofacebookincubator:mainfrom
Conversation
✅ Deploy Preview for meta-velox canceled.
|
|
@xiaoxmeng has exported this pull request. If you are a Meta employee, you can view the originating Diff in D98260058. |
Build Impact AnalysisDirectly Changed Targets
Selective Build Targets (building these covers all 293 affected)Total affected: 293/555 targets
All affected targets (293)
Fast path • Graph from main@ee7708ef8383697e111815f40d60a0a1a49a8d34 |
4ad56de to
ca8cade
Compare
xiaoxmeng
added a commit
to xiaoxmeng/nimble
that referenced
this pull request
Mar 28, 2026
…ng (facebookincubator#616) Summary: X-link: facebookincubator/velox#16948 CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution. WHAT: 1. **MetadataCache**: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types: - Preloaded: strong refs moved to weak cache after first access - Pinned: strong refs when `pinEntries_=true`, never evicted - Cached: weak refs (existing behavior) Uses read-lock fast path (shared_mutex) with builder called outside both locks. 2. **TabletReader**: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added `pinMetadataInCache` option to pin parsed metadata objects with strong references. 3. **ReaderOptions**: Added `pinMetadataInCache()` getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses. 4. **ReaderBase**: Replaced `prevStripeIdentifier_` class member with local variable in `setStripe()` — only needs to stay alive during the call. 5. **Test coverage**: - MetadataCacheTest: 9 tests including preload, customBuilder, preloadDoesNotOverwrite (parameterized over pin/non-pin mode), and concurrent fuzzer test with 8 threads. - E2EFilterTest: Extended parameterization with pinMetadataInCache. - E2EIndexTest: Extended parameterization with pinMetadataInCache + test loop over enableCache. - SelectiveNimbleReaderTest: Added pinMetadataInCache test with enableCache loop. 6. **Benchmark tuning**: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark. Reviewed By: tanjialiang, HuamengJiang, kewang1024 Differential Revision: D98260058
xiaoxmeng
added a commit
to xiaoxmeng/nimble
that referenced
this pull request
Mar 28, 2026
…ng (facebookincubator#616) Summary: X-link: facebookincubator/velox#16948 CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution. WHAT: 1. **MetadataCache**: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types: - Preloaded: strong refs moved to weak cache after first access - Pinned: strong refs when `pinEntries_=true`, never evicted - Cached: weak refs (existing behavior) Uses read-lock fast path (shared_mutex) with builder called outside both locks. 2. **TabletReader**: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added `pinMetadataInCache` option to pin parsed metadata objects with strong references. 3. **ReaderOptions**: Added `pinMetadataInCache()` getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses. 4. **ReaderBase**: Replaced `prevStripeIdentifier_` class member with local variable in `setStripe()` — only needs to stay alive during the call. 5. **Test coverage**: - MetadataCacheTest: 9 tests including preload, customBuilder, preloadDoesNotOverwrite (parameterized over pin/non-pin mode), and concurrent fuzzer test with 8 threads. - E2EFilterTest: Extended parameterization with pinMetadataInCache. - E2EIndexTest: Extended parameterization with pinMetadataInCache + test loop over enableCache. - SelectiveNimbleReaderTest: Added pinMetadataInCache test with enableCache loop. 6. **Benchmark tuning**: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark. Reviewed By: tanjialiang, HuamengJiang, kewang1024 Differential Revision: D98260058
ca8cade to
be98cdd
Compare
be98cdd to
848b59f
Compare
xiaoxmeng
added a commit
to xiaoxmeng/nimble
that referenced
this pull request
Mar 28, 2026
…ng (facebookincubator#616) Summary: X-link: facebookincubator/velox#16948 Pull Request resolved: facebookincubator#616 CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution. WHAT: 1. **MetadataCache**: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types: - Preloaded: strong refs moved to weak cache after first access - Pinned: strong refs when `pinEntries_=true`, never evicted - Cached: weak refs (existing behavior) Uses read-lock fast path (shared_mutex) with builder called outside both locks. 2. **TabletReader**: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added `pinMetadataInCache` option to pin parsed metadata objects with strong references. 3. **ReaderOptions**: Added `pinMetadataInCache()` getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses. 4. **ReaderBase**: Replaced `prevStripeIdentifier_` class member with local variable in `setStripe()` — only needs to stay alive during the call. 5. **Test coverage**: - MetadataCacheTest: 9 tests including preload, customBuilder, preloadDoesNotOverwrite (parameterized over pin/non-pin mode), and concurrent fuzzer test with 8 threads. - E2EFilterTest: Extended parameterization with pinMetadataInCache. - E2EIndexTest: Extended parameterization with pinMetadataInCache + test loop over enableCache. - SelectiveNimbleReaderTest: Added pinMetadataInCache test with enableCache loop. 6. **Benchmark tuning**: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark. Reviewed By: tanjialiang, HuamengJiang, kewang1024 Differential Revision: D98260058
848b59f to
0e48213
Compare
0e48213 to
306261d
Compare
xiaoxmeng
added a commit
to xiaoxmeng/nimble
that referenced
this pull request
Mar 28, 2026
…ng (facebookincubator#616) Summary: X-link: facebookincubator/velox#16948 CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution. WHAT: 1. **MetadataCache**: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types: - Preloaded: strong refs moved to weak cache after first access - Pinned: strong refs when `pinEntries_=true`, never evicted - Cached: weak refs (existing behavior) Uses read-lock fast path (shared_mutex) with builder called outside both locks. 2. **TabletReader**: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added `pinMetadataInCache` option to pin parsed metadata objects with strong references. 3. **ReaderOptions**: Added `pinMetadataInCache()` getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses. 4. **ReaderBase**: Replaced `prevStripeIdentifier_` class member with local variable in `setStripe()` — only needs to stay alive during the call. 5. **Test coverage**: - MetadataCacheTest: 9 tests including preload, customBuilder, preloadDoesNotOverwrite (parameterized over pin/non-pin mode), and concurrent fuzzer test with 8 threads. - E2EFilterTest: Extended parameterization with pinMetadataInCache. - E2EIndexTest: Extended parameterization with pinMetadataInCache + test loop over enableCache. - SelectiveNimbleReaderTest: Added pinMetadataInCache test with enableCache loop. 6. **Benchmark tuning**: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark. Reviewed By: tanjialiang, HuamengJiang, kewang1024 Differential Revision: D98260058
306261d to
55aa890
Compare
55aa890 to
993ebcd
Compare
xiaoxmeng
added a commit
to xiaoxmeng/nimble
that referenced
this pull request
Mar 28, 2026
…ng (facebookincubator#616) Summary: X-link: facebookincubator/velox#16948 CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution. WHAT: 1. **MetadataCache**: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types: - Preloaded: strong refs moved to weak cache after first access - Pinned: strong refs when `pinEntries_=true`, never evicted - Cached: weak refs (existing behavior) Uses read-lock fast path (shared_mutex) with builder called outside both locks. 2. **TabletReader**: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added `pinMetadataInCache` option to pin parsed metadata objects with strong references. 3. **ReaderOptions**: Added `pinMetadataInCache()` getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses. 4. **ReaderBase**: Replaced `prevStripeIdentifier_` class member with local variable in `setStripe()` — only needs to stay alive during the call. 5. **Test coverage**: - MetadataCacheTest: 9 tests including preload, customBuilder, preloadDoesNotOverwrite (parameterized over pin/non-pin mode), and concurrent fuzzer test with 8 threads. - E2EFilterTest: Extended parameterization with pinMetadataInCache. - E2EIndexTest: Extended parameterization with pinMetadataInCache + test loop over enableCache. - SelectiveNimbleReaderTest: Added pinMetadataInCache test with enableCache loop. 6. **Benchmark tuning**: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark. Reviewed By: tanjialiang, HuamengJiang, kewang1024 Differential Revision: D98260058
xiaoxmeng
added a commit
to xiaoxmeng/nimble
that referenced
this pull request
Mar 28, 2026
…ng (facebookincubator#616) Summary: X-link: facebookincubator/velox#16948 CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution. WHAT: 1. **MetadataCache**: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types: - Preloaded: strong refs moved to weak cache after first access - Pinned: strong refs when `pinEntries_=true`, never evicted - Cached: weak refs (existing behavior) Uses read-lock fast path (shared_mutex) with builder called outside both locks. 2. **TabletReader**: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added `pinMetadataInCache` option to pin parsed metadata objects with strong references. 3. **ReaderOptions**: Added `pinMetadataInCache()` getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses. 4. **ReaderBase**: Replaced `prevStripeIdentifier_` class member with local variable in `setStripe()` — only needs to stay alive during the call. 5. **Test coverage**: - MetadataCacheTest: 9 tests including preload, customBuilder, preloadDoesNotOverwrite (parameterized over pin/non-pin mode), and concurrent fuzzer test with 8 threads. - E2EFilterTest: Extended parameterization with pinMetadataInCache. - E2EIndexTest: Extended parameterization with pinMetadataInCache + test loop over enableCache. - SelectiveNimbleReaderTest: Added pinMetadataInCache test with enableCache loop. 6. **Benchmark tuning**: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark. Reviewed By: tanjialiang, HuamengJiang, kewang1024 Differential Revision: D98260058
993ebcd to
1ba8ff8
Compare
duanmeng
approved these changes
Mar 28, 2026
zacw7
approved these changes
Mar 28, 2026
xiaoxmeng
added a commit
to xiaoxmeng/nimble
that referenced
this pull request
Mar 28, 2026
…ng (facebookincubator#616) Summary: X-link: facebookincubator/velox#16948 CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution. WHAT: 1. **MetadataCache**: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types: - Preloaded: strong refs moved to weak cache after first access - Pinned: strong refs when `pinEntries_=true`, never evicted - Cached: weak refs (existing behavior) Uses read-lock fast path (shared_mutex) with builder called outside both locks. 2. **TabletReader**: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added `pinMetadataInCache` option to pin parsed metadata objects with strong references. 3. **ReaderOptions**: Added `pinMetadataInCache()` getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses. 4. **ReaderBase**: Replaced `prevStripeIdentifier_` class member with local variable in `setStripe()` — only needs to stay alive during the call. 5. **Test coverage**: - MetadataCacheTest: 9 tests including preload, customBuilder, preloadDoesNotOverwrite (parameterized over pin/non-pin mode), and concurrent fuzzer test with 8 threads. - E2EFilterTest: Extended parameterization with pinMetadataInCache. - E2EIndexTest: Extended parameterization with pinMetadataInCache + test loop over enableCache. - SelectiveNimbleReaderTest: Added pinMetadataInCache test with enableCache loop. 6. **Benchmark tuning**: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark. Reviewed By: tanjialiang, HuamengJiang, kewang1024 Differential Revision: D98260058
1ba8ff8 to
865282e
Compare
xiaoxmeng
added a commit
to xiaoxmeng/nimble
that referenced
this pull request
Mar 28, 2026
…ng (facebookincubator#616) Summary: X-link: facebookincubator/velox#16948 CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution. WHAT: 1. **MetadataCache**: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types: - Preloaded: strong refs moved to weak cache after first access - Pinned: strong refs when `pinEntries_=true`, never evicted - Cached: weak refs (existing behavior) Uses read-lock fast path (shared_mutex) with builder called outside both locks. 2. **TabletReader**: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added `pinMetadataInCache` option to pin parsed metadata objects with strong references. 3. **ReaderOptions**: Added `pinMetadataInCache()` getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses. 4. **ReaderBase**: Replaced `prevStripeIdentifier_` class member with local variable in `setStripe()` — only needs to stay alive during the call. 5. **Test coverage**: - MetadataCacheTest: 9 tests including preload, customBuilder, preloadDoesNotOverwrite (parameterized over pin/non-pin mode), and concurrent fuzzer test with 8 threads. - E2EFilterTest: Extended parameterization with pinMetadataInCache. - E2EIndexTest: Extended parameterization with pinMetadataInCache + test loop over enableCache. - SelectiveNimbleReaderTest: Added pinMetadataInCache test with enableCache loop. 6. **Benchmark tuning**: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark. Reviewed By: tanjialiang, HuamengJiang, kewang1024 Differential Revision: D98260058
865282e to
39103cf
Compare
xiaoxmeng
added a commit
to xiaoxmeng/nimble
that referenced
this pull request
Mar 29, 2026
…ng (facebookincubator#616) Summary: X-link: facebookincubator/velox#16948 CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution. WHAT: 1. **MetadataCache**: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types: - Preloaded: strong refs moved to weak cache after first access - Pinned: strong refs when `pinEntries_=true`, never evicted - Cached: weak refs (existing behavior) Uses read-lock fast path (shared_mutex) with builder called outside both locks. 2. **TabletReader**: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added `pinMetadataInCache` option to pin parsed metadata objects with strong references. 3. **ReaderOptions**: Added `pinMetadataInCache()` getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses. 4. **ReaderBase**: Replaced `prevStripeIdentifier_` class member with local variable in `setStripe()` — only needs to stay alive during the call. 5. **Test coverage**: - MetadataCacheTest: 9 tests including preload, customBuilder, preloadDoesNotOverwrite (parameterized over pin/non-pin mode), and concurrent fuzzer test with 8 threads. - E2EFilterTest: Extended parameterization with pinMetadataInCache. - E2EIndexTest: Extended parameterization with pinMetadataInCache + test loop over enableCache. - SelectiveNimbleReaderTest: Added pinMetadataInCache test with enableCache loop. 6. **Benchmark tuning**: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark. Reviewed By: tanjialiang, HuamengJiang, kewang1024 Differential Revision: D98260058
39103cf to
ad0755e
Compare
ad0755e to
a2166b2
Compare
…ng (facebookincubator#16948) Summary: Pull Request resolved: facebookincubator#16948 X-link: facebookincubator/nimble#616 CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution. WHAT: 1. **MetadataCache**: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types: - Preloaded: strong refs moved to weak cache after first access - Pinned: strong refs when `pinEntries_=true`, never evicted - Cached: weak refs (existing behavior) Uses read-lock fast path (shared_mutex) with builder called outside both locks. 2. **TabletReader**: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added `pinMetadataInCache` option to pin parsed metadata objects with strong references. 3. **ReaderOptions**: Added `pinMetadataInCache()` getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses. 4. **ReaderBase**: Replaced `prevStripeIdentifier_` class member with local variable in `setStripe()` — only needs to stay alive during the call. 5. **Test coverage**: - MetadataCacheTest: 9 tests including preload, customBuilder, preloadDoesNotOverwrite (parameterized over pin/non-pin mode), and concurrent fuzzer test with 8 threads. - E2EFilterTest: Extended parameterization with pinMetadataInCache. - E2EIndexTest: Extended parameterization with pinMetadataInCache + test loop over enableCache. - SelectiveNimbleReaderTest: Added pinMetadataInCache test with enableCache loop. 6. **Benchmark tuning**: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark. Reviewed By: tanjialiang, HuamengJiang, kewang1024 Differential Revision: D98260058
a2166b2 to
fc3ed98
Compare
meta-codesync Bot
pushed a commit
to facebookincubator/nimble
that referenced
this pull request
Mar 29, 2026
…ng (#616) Summary: X-link: facebookincubator/velox#16948 Pull Request resolved: #616 CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution. WHAT: 1. **MetadataCache**: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types: - Preloaded: strong refs moved to weak cache after first access - Pinned: strong refs when `pinEntries_=true`, never evicted - Cached: weak refs (existing behavior) Uses read-lock fast path (shared_mutex) with builder called outside both locks. 2. **TabletReader**: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added `pinMetadataInCache` option to pin parsed metadata objects with strong references. 3. **ReaderOptions**: Added `pinMetadataInCache()` getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses. 4. **ReaderBase**: Replaced `prevStripeIdentifier_` class member with local variable in `setStripe()` — only needs to stay alive during the call. 5. **Test coverage**: - MetadataCacheTest: 9 tests including preload, customBuilder, preloadDoesNotOverwrite (parameterized over pin/non-pin mode), and concurrent fuzzer test with 8 threads. - E2EFilterTest: Extended parameterization with pinMetadataInCache. - E2EIndexTest: Extended parameterization with pinMetadataInCache + test loop over enableCache. - SelectiveNimbleReaderTest: Added pinMetadataInCache test with enableCache loop. 6. **Benchmark tuning**: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark. Reviewed By: tanjialiang, HuamengJiang, kewang1024 Differential Revision: D98260058 fbshipit-source-id: 0b35ba8ae543578ab5e761d652c23cff26011675
|
This pull request has been merged in 60fea0d. |
Collaborator
|
@xiaoxmeng, @Yuhta : Wondering if some of these ideas can be leveraged for ParquetReader as well.... Do you'll have any plans ? |
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.
Summary:
X-link: facebookincubator/nimble#616
CONTEXT: Nimble's metadata IO (stripe groups, cluster index, chunk index) uses a weak-pointer cache (ReferenceCountedCache) that expires entries as soon as the last reference is dropped. For workloads that access multiple stripes, metadata gets re-read and re-parsed on every stripe access. Additionally, when AsyncDataCache is enabled, both metadata and data are cached indiscriminately — metadata is small and hot while data is large and often cold, leading to cache pollution.
WHAT:
MetadataCache: New thread-safe template cache (MetadataCache.h) replacing ReferenceCountedCache with three entry types:
pinEntries_=true, never evictedUses read-lock fast path (shared_mutex) with builder called outside both locks.
TabletReader: Migrated stripeGroupCache_, clusterIndexCache_, chunkIndexCache_ from ReferenceCountedCache to MetadataCache. Added
pinMetadataInCacheoption to pin parsed metadata objects with strong references.ReaderOptions: Added
pinMetadataInCache()getter/setter to velox::dwio::common::ReaderOptions. When enabled, pins metadata in the reader's MetadataCache so it survives across stripe accesses.ReaderBase: Replaced
prevStripeIdentifier_class member with local variable insetStripe()— only needs to stay alive during the call.Test coverage:
Benchmark tuning: Changed chunk_index_min_avg_chunks default to 1.0, commented out custom sizeClassSizes, removed setIOExecutor in cluster index benchmark.
Reviewed By: tanjialiang, HuamengJiang, kewang1024
Differential Revision: D98260058