Skip to content

v0.16.1

Compare
Choose a tag to compare
@simerplaha simerplaha released this 05 Oct 13:29
· 460 commits to master since this release

Release overview

  • Improved SkipList implementation for faster writes and atomic reads
  • Removed snapshotting LevelZero state for reads.

Improved write performance for sequential writes

Implemented a faster NavigableMap (for SequentialOrder writes) backed by Array and binary-search which can be enabled for applications that only require sequential writes and do not need random writes.

The following shows benchmarks of SequentialOrder (Array) vs RandomOrder (java.ConcurrentSkipListMap) for sequential writes.

image

How to optimise SwayDB for SequentialOrder writes?

Default setting optimises writes for RandomOrder. The following code samples optimise writes for SequentialOrder.

initialSkipListLength sets the length of the Array since SequentialOrder is backed by Array.

Java

Map<Integer, String, Void> map =
  MemoryMap
    .functionsOff(Default.intSerializer(), Default.stringSerializer())
    .setOptimiseWrites(OptimiseWrites.sequentialOrder(10000))
    .get();

Scala

val map = 
  memory.Map[Int, String, Nothing, Bag.Less](
    optimiseWrites = OptimiseWrites.SequentialOrder(initialSkipListLength = 10000)
  )

Atomic SkipList reads

Previously SkipList required copying in-memory key-values for atomicity (#124). Now LevelZero performs atomic reads without copying.

Default setting disables Atomic which can be enabled with the following.

Java

Map<Integer, String, Void> map =
  MemoryMap
    .functionsOff(Default.intSerializer(), Default.stringSerializer())
    .setAtomic(Atomic.on())
    .get();

Scala

val map =
  memory.Map[Int, String, Nothing, Bag.Less](atomic = Atomic.On)

Removed snapshotting

Previously reads were creating a snapshot which provided the state of write-ahead-log files in LevelZero for each read. Now snapshotting happen lazily (Stream like) as the read progresses. This change was aimed to further minimise GC workload.