feat: Add gzip compression for large cache entries to reduce memory footprint#2099
Merged
Conversation
2f8fac5 to
cc12879
Compare
f0f4be9 to
1cfd581
Compare
- Compress cache responses larger than 1MB to save memory - JSON responses typically compress 70-90%, significantly reducing memory footprint - Automatically decompress on cache retrieval - Track compression status in CacheValue struct - Use centralized protocol/common compression module to avoid code duplication - Remove duplicate compression functions from cache handlers Test coverage: - Test compress/decompress roundtrip with various payloads - Test error handling for invalid gzip data - Test formatCacheValue compression logic with threshold - Test automatic decompression on cache retrieval - Test Cost() method returns compressed size - Test compression ratio for realistic JSON payloads (98.88% for repeated JSON) - All tests pass successfully
1cfd581 to
60e8bb9
Compare
This error occurs when providers forward node errors (like 'Internal error') back to consumers. This is expected behavior, especially during E2E tests where unsupported methods or node issues can trigger these errors. Related to commit ca8987c which refactored unsupported method error handling.
avitenzer
approved these changes
Nov 20, 2025
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.
Description
This PR implements gzip compression for large cache entries to significantly reduce memory footprint in the cache service.
Problem
Cache entries for large debug queries (30+ MB JSON responses) were consuming excessive memory, leading to potential OOM issues in high-throughput scenarios.
Solution
IsCompressedflag inCacheValueChanges
ecosystem/cache/handlers.go:CompressionThresholdconstant (1MB)IsCompressedfield toCacheValuestructcompressData()anddecompressData()helper functionsformatCacheValue()to compress large responsesToCacheReply()to automatically decompress on retrievalCost()to reflect actual stored size (compressed if applicable)ecosystem/cache/handlers_test.go(new file):Impact
Closes: #XXXX
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
perf)!in the type prefix if API or client breaking change (N/A - no breaking changes)mainbranchReviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...