Skip to content

New option to cache data - #6500

Open
ArbaazKhan1 wants to merge 2 commits into
apache:mainfrom
ArbaazKhan1:accumulo-6023
Open

New option to cache data#6500
ArbaazKhan1 wants to merge 2 commits into
apache:mainfrom
ArbaazKhan1:accumulo-6023

Conversation

@ArbaazKhan1

Copy link
Copy Markdown
Contributor

Closes issue #6023

Implements a new optional compressed block cache for RFile blocks. Currently Accumulo's primary block cache stores uncompressed blocks for tablets with high compression ratios. This means cached data takes up more space on the Heap than the corresponding on-disk footprint, reducing the number of distinct blocks that can be held in memory.

The changes here add an optional compressed data cache to TabletServers and ScanServers. When enabled blocks are compressed before being stored in the secondary cache and transparently decompressed when read. The feature is disabled by default, so existing deployments are unchanged unless the new properties are used.

Changes:

  • Added CompressedBlockCache to compress blocks before storing them and decompressing them on retrieval
  • Added configurable cache sized for Tablet and Scan servers
  • Added a secondary cache lookup path: primary cache → compressed cache → disk.
  • Blocks retrieved from the compressed cache are decompressed and promoted back into the primary cache.
  • Updated the cache provider and TabletServer resource management to support the new cache.

@dlmarion

Copy link
Copy Markdown
Contributor

Reading over @keith-turner's notes in #6023, I'm not sure that this is the implementation that he envisioned. He said,

This could potentially be implemented without any changes to Accumulo. The only drawback to that is we would always uncompress the data when reading from disk and then recompress it when storing in the cache. This could be expensive. To allow taking compressed rfile blocks directly from disk and storing them in cache would require a change in Accumulo because it always uncompresses before caching.

Maybe its best to leave the on heap primary cache as uncompressed and have a secondary cache (possibly off heap) that compresses blocks. This could likely be done w/o any changes to Accumulo as it could be done completely by plugins.

Accumulo has a Block Cache Manager SPI and provides two implementations (Lru and TinyLFU) that store uncompressed cached blocks on heap. There are also two other implementations that use the on-heap block cache as a L1 cache and then use some other facility for storing blocks off-heap. Those implementations are https://github.com/keith-turner/accumulo-ohc and https://github.com/dlmarion/accumulo-shared-offheap-cache.

I think what @keith-turner was suggesting is that the SPI implementation could cache the off-heap blocks in a compressed manner and handle the compression / decompression. This would likely require no changes to Accumulo code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optionally cache compressed data

2 participants