simerplaha / SwayDB

Persistent and in-memory key-value storage engine for JVM that scales on a single machine.
https://swaydb.simer.au
Apache License 2.0
293 stars 16 forks source link

Implement `BlockCacheSkipListIO` #343

Open simerplaha opened 2 years ago

simerplaha commented 2 years ago

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

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.