fix: reduce API test memory consumption from 8.26GB to 1.57GB (#8263) #9097
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.
Memory Optimization Fix for API Tests - Issue #8263
API tests were consuming excessive memory (>40 GiB virtual, >6 GiB resident), causing slower test execution and reduced developer adoption.
RCA
Memory Profile Findings (Before Optimization)
ristretto.newCmRow
: 4.5 GB (54.42%)ristretto.Bloom.Size
: 2.2 GB (27.21%)Root Cause
Default Production Configuration in Tests: Tests were using production-level cache sizes:
committed.local_cache.size_bytes
: 1 GB (default)committed.sstable.memory.cache_size_bytes
: 400 MB (default)Ristretto Cache Overhead: The ristretto cache allocates 10 million counters regardless of actual cache capacity, creating massive memory overhead for test environments.
Multiple Cache Instances: Each test creates two pyramid filesystem caches:
Test Repetition: 50+ controller tests each calling
setupHandler()
with fresh cache instances.Results
Memory Allocation Improvement
Ristretto Cache Impact
Testing
Verification
Fixes #8263