DBDB.io The Encyclopedia of Database Systems · Est. 2017
Database of Databases

Database Entry

HerdDB


HerdDB is a distributed SQL DBMS implemented in Java, optimized for primary key read/update access patterns. It has been designed to be embeddable in any Java Virtual Machine.[03]

Source Code
https://github.com/diennea/herddb[02]
Developer
Country of Origin
IT
Start Year
2016 [08]
Project Type
Open Source
Written in
Java
Embeds / Uses
Zookeeper
Operating System
Linux
License
Apache v2

Database Entry

HerdDB


HerdDB is a distributed SQL DBMS implemented in Java, optimized for primary key read/update access patterns. It has been designed to be embeddable in any Java Virtual Machine.[03]

Checkpoints[04][05]


HerdDB supports periodic checkpoints, every 15 minutes by default. At checkpoints, active page ids are written to disk with their current log sequence numbers. At the same time all dirty pages are discarded and their records used to build new pages, among other new or updated records. Checkpoints can be tuned to be either as fast as possible or as clean as possible. Fast checkpoints block write operations for less time, whereas clean checkpoints optimize memory usage (fewer dirty pages left in memory) and speed up searches (fewer dirty pages left on disk).

Concurrency Control


Before accessing records, clients acquire read or write locks. Every transaction that modifies a record holds the new data in a local buffer copy, and this new version of the record is not visible to other transactions until that one is committed (Pessimistic Row Level Locking).

Data Model


Foreign Keys[06]


Indexes


Isolation Levels[06]


Joins[06]


Logging


WAL replication based on Apache BookKeeper.

Query Compilation


Query Execution


Query Interface[06]


Storage Architecture[04]


Storage Model[04]


HerdDB’s internal architecture stores a table as a set of key-value entries. This is implemented in Java by a very large map of binary data. Each row is translated from column-oriented to key-value format by tearing apart the “primary key” part (one or multiple columns) from the “value” part (other columns).

Storage Organization[04]


At any given time, some part of the data is stored in a memory buffer and some other on disk. Transaction logs are the source-of-truth and the whole database can be recovered from them plus a checkpoint to ensure that no data can be lost on JVM crashes. When a row is stored on disk it is assigned to a "data page"; on its first mutation, it is detached from its data page and that page is marked as “dirty”. At checkpoints, all dirty pages are dismissed and their records used to build new pages, among other new or updated records. Records modified/inserted/deleted in the scope of a transaction are never written to disk and they are not present in the main buffer until that transaction is committed, so that there is always a consistent and committed data snapshot. Every transaction uses its own local buffer to store temporary data.

Stored Procedures[06]


System Architecture[07]


WAL replication and distributed configuration based on Apache Zookeeper and Apache BookKeeper.

Views[06]


Citations

8 sources
  1. HerdDB - Diennea herddb.org
  2. GitHub - diennea/herddb: A JVM-embeddable Distributed Database · GitHub github.com
  3. Home · diennea/herddb Wiki · GitHub github.com
  4. Data storage · diennea/herddb Wiki · GitHub github.com
  5. Checkpoints configuration · diennea/herddb Wiki · GitHub github.com
  6. SQL Support · diennea/herddb Wiki · GitHub github.com
  7. Replication · diennea/herddb Wiki · GitHub github.com
  8. Releases · diennea/herddb github.com
Revision #5 Last Updated: