Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement BlockCacheSkipListIO #343

Open
simerplaha opened this issue Dec 11, 2021 · 0 comments
Open

Implement BlockCacheSkipListIO #343

simerplaha opened this issue Dec 11, 2021 · 0 comments

Comments

@simerplaha
Copy link
Owner

simerplaha commented Dec 11, 2021

Overview

Currently BlockCacheIO caches byte arrays in equal sizes of blockSize/minIOSeekSize each. This provides faster HashMap inserts and lookups since keys themselves are just Long values (unique and no hash conflicts) but

  • It has the cost of needing to join multiple Array[Byte] if the required data is greater than minIOSeekSize.
  • Need multiple ConcurrentHashMap lookups if the required data is greater than minIOSeekSize.
  • Synchronised - java.nio.ScatteringByteChannel already provides an API which slices the data into smaller Array[Byte]s of minIOSeekSize each (so not in-memory slicing/copying is required) but this API still needs synchronised (blocking) access since ScatteringByteChannel mutates the position in the FileChannel.
  • Synchronised can be removed by not using ScatteringByteChannel and slicing data manually in-memory but this creates a lot more on-heap allocations which costs GC time.

Task

Another BlockCacheSkipListIO based on ConcurrentSkipList is required which allows caching randomly sized data. This will not need synchronised access and will provide easier caching but in comparison to ConcurrentHashMap, inserts and lookups will be slower which in some cases might not be noticeable since multiple lookups to join multiple byte arrays (in ConcurrentHashMap's cases) might not be required.

Configuration

Either one of the caching strategy should be configurable.

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

No branches or pull requests

1 participant