Type-safe, non-blocking, back-pressured key-value storage library for single/multiple disks & in-memory - www.SwayDB.io
Clone or download
Latest commit 19780c4 Oct 20, 2018


SwayDB Gitter Chat

SwayDB is a type-safe & non-blocking key-value storage library for single/multiple disks and in-memory storage.

It's an implementation of Log-structured merge-tree written in Scala with asynchronous Leveled Compaction based on push-pull strategy built on the Actor model.

It supports configurable Graph like file format for faster reads and has compression support for both memory & persistent databases.

Documentation: http://swaydb.io


Storage type Performance
Persistent up to 308,000 writes/sec & 316,000 reads/sec
In memory up to 653,000 writes/sec & 628,000 reads/sec

View detailed benchmark results here.


  • Embeddable, Type-safe, non-blocking
  • Single or multiple disks persistent, in-memory or periodically persistent
  • ACID like atomic writes with Batch API
  • APIs similar to Scala collections.
  • Auto expiring key-value (TTL)
  • Range update, remove & expire
  • Key only iterations (Lazily fetched values)
  • Supported data types
    • Map[K, V]
    • Set[T]
  • In-built custom serialization API with Slice
  • Configurable Levels
  • Configurable cacheSize
  • Concurrent level compaction
  • Duplicate values can be detected and written only ones with the configuration compressDuplicateValues.
  • Compression with LZ4 & Snappy are fully supported for both Persistent & Memory databases for each Level.
  • All LZ4 instances, compressors & decompressors are configurable.
    • LZ4 Instances - FastestInstance, FastestJavaInstance, NativeInstance, SafeInstance & UnsafeInstance.
    • LZ4 Compressors - FastCompressor & HighCompressor.
    • LZ4 Decompressors - FastDecompressor & SafeDecompressor.
  • Optional Memory-mapped files
  • Scala Streams
  • Bloom filters
  • Fault tolerant

Read more.

Demo API

//Iteration: fetch all key-values withing range 10 to 90, update values and batch write updated key-values
  .tillKey(_ <= 90)
  .map {
    case (key, value) =>
      (key, value + "_updated")
  } andThen {
     updatedKeyValues =>

Quick start

Quick start demo.


Related GitHub projects

Status: Beta

Undergoing integration, stress & performance testing.