Add off-heap memory cache architecture analysis for ZipDrive’s memory tier#44
Draft
Copilot wants to merge 4 commits into
Draft
Add off-heap memory cache architecture analysis for ZipDrive’s memory tier#44Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
Agent-Logs-Url: https://github.com/hooyao/ZipDrive/sessions/ac2193f3-653b-4b58-869d-41b1ba834e17 Co-authored-by: hooyao <659145+hooyao@users.noreply.github.com>
Agent-Logs-Url: https://github.com/hooyao/ZipDrive/sessions/ac2193f3-653b-4b58-869d-41b1ba834e17 Co-authored-by: hooyao <659145+hooyao@users.noreply.github.com>
Agent-Logs-Url: https://github.com/hooyao/ZipDrive/sessions/ac2193f3-653b-4b58-869d-41b1ba834e17 Co-authored-by: hooyao <659145+hooyao@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Analyze and design cache memory architecture
Add off-heap memory cache architecture analysis for ZipDrive’s memory tier
Apr 6, 2026
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.
The current memory tier stores cache entries as large managed
byte[], which is a poor fit for a long-lived content cache because it increases GC pressure and makes memory usage harder to shape. Simply switching to per-entry unmanaged aligned allocations would move the problem off-heap, but would not address fragmentation or allocator control.Problem framing
MemoryStorageStrategydesign is simple but weak for long-lived cache residency.Option analysis
byte[]AlignedAllocis only a partial improvement.Recommended memory-tier architecture
IStorageStrategy<Stream>boundary.GenericCacheinvariants: lock-free hits, per-key materialization dedupe, ref-counted borrow/return, and deferred orphan cleanup.ZipDrive integration shape
ArenaMemoryStorageStrategyIUnmanagedMemoryAllocatorArenaBackedBufferIndustry references
Documentation wiring
src/Docs/MEMORY_CACHE_ARCHITECTURE_DESIGN.mdsrc/Docs/CACHING_DESIGN.mdsrc/ZipDrive.Infrastructure.Caching/README.mdExample direction proposed in the design:
This keeps ZipDrive’s current cache concurrency model intact while shifting the memory-tier discussion from “replace
byte[]with unmanaged blocks” to “introduce an allocator designed for long-lived cache workloads.”Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cachelib.org/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)docs.memcached.org/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)redis.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either: