SwayDB

SwayDB is an embedded, non-blocking and type-safe NoSql database. It can be configured for both persistent and in-memory storage. It provides Scala and Java API. It reaches up to 600,000 writes per second for in-memory databases and up to 300,000 for persistent databases. Log-structured merge-tree is the main underlying algorithm.

History

SwayDB started in 2017, and had its first release in 2018. Currently, it is under beta release.

Concurrency Control

Not Supported

SwayDB assumes it runs 'under a single process in a single application', as the author clarifies on Reddit. Everything is atomic in SwayDB, including transactions. The only guarantee it has on transactions is atomicity. No concurrency control is needed, and indeed it is not mentioned in docs at all.

Query Interface

Custom API

SwayDB is used embedded in applications. The API is in Scala with its custom APIs. A Java wrapper is also implemented for Java APIs.

Compression

Naïve (Page-Level)

SwayDB supports compressing segments using LZ4 and Snappy, which are open-sourced Java compression tools. Strictly-speaking, the compression is done on segment level instead of page level, where segments are chunks of key-value pairs in a Log-Structured Merge Tree.

Logging

Physical Logging

Write ahead logging is used for its persistent version databases. Because it is a key-value store, it does not have the notion of pages. The logs are physical logging of write operations.

Indexes

Log-Structured Merge Tree

SwayDB organizes data in levels of segments, using the Log-Structured Merge Tree data structure. Upper levels write to lower levels in batches when it is full or the user explicitly demanded. Bloom Filters are used in each segment to search quickly whether a key belongs to that segment.

Stored Procedures

Not Supported

Checkpoints

Not Supported

No checkpoints are supported. For its in-memory implementation, no checkpointing or logging is supported. For the persistent version, it can persist its memory segments to disk, but this is used for reducing that level's storage, not for recovery.

System Architecture

Embedded

SwayDB is an embedded database.

Foreign Keys

Not Supported

Data Model

Key/Value

SwayDB is a key-value store, having Map[K, V] and Set[T] for data storage and providing APIs to create, read, stream, update, delete & expire data.

Isolation Levels

Serializable

Since every operation is atomic and runs on the same memory space, it is serializable.

SwayDB Logo
Website

http://www.swaydb.io/

Source Code

https://github.com/simerplaha/SwayDB

Tech Docs

http://www.swaydb.io/

Developer

Simer Plaha

Country of Origin

AU

Start Year

2018

Project Type

Commercial, Open Source

Written in

Scala

Supported languages

Java, Scala

Licenses

AGPL v3