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

Programming language: Scala
Tags: Database     Tools     Type-Safe    
Latest version: v0.9-ALPHA.1

SwayDB alternatives and similar packages

Based on the "Database" category

Do you think we are missing an alternative of SwayDB or a related project?

Add another 'Database' Package


SwayDB Slack Chat Gitter Chat Build status Maven central

Embeddable persistent and in-memory database for resource efficiency, performance and easy data management with simple collections API.

Documentation - 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.


  • Java & Kotlin wrappers.
  • Single or multiple disks persistent, in-memory or periodically persistent.
  • Simple Stream based iteration following Scala collections APIs.
  • Atomic updates and inserts.
  • Custom updates using JVM function.
  • TTL - auto expiring key-values.
  • Range update, remove & expire.
  • Key only iterations (Lazily fetched values).
  • Supported data types - Map[K, V] & Set[T].
  • Configurable levels.
  • Compression for both Persistent & Memory databases with LZ4 & Snappy.
  • Duplicate values can be eliminated with compressDuplicateValues.

Read more.

Demo Streaming API

//Iteration: fetch all key-values withing range 10 to 90, update values and batch write updated key-values
  .takeWhile {
    case (key, value) =>
      key <= 90
  .map {
    case (key, value) =>
      (key, value + "_updated")
  .flatMap(db.put) //write updated key-values to database

Quick start

Quick start demo.

Project status

Undergoing frequent changes & beta testing.

See the tags to see a more stable version. Default branch is develop and is pushed to directly so at times it will be unstable.

Project support

Thank you Jetbrains for providing an open-source licence for their awesome development tools.