FoundationDB is a distributed non-relational database that supports ACID transactions and OLTP workloads. FoundationDB decouples its data storage technology from its data model. All data is stored as an ordered key-value data structure and can be remapped to custom data models or indexes by using user-written layer module API. FoundationDB doesn’t have any separate query language, it only exposes API to access data. [03][05]
- Source Code
- https://github.com/apple/foundationdb[02]
- @FoundationDB
- Developer
- Country of Origin
- US
- Start Year
- 2009 [08]
- Acquired By
- Project Type
- Open Source
- Written in
- C++
- Embeds / Uses
- SQLite
- License
- Apache v2
FoundationDB was famous for having rigorous and thorough testing of their fault tolerance. They built their own [deterministic testing] (https://www.youtube.com/watch?v=4fFDFbi3toc) while developing their system to make sure their system implementation behaves correctly. The simulation was built to model real-life scenarios, such as a combination of transaction executions while having network failure, database configuration change, and human operator errors.
FoundationDB is a distributed non-relational database that supports ACID transactions and OLTP workloads. FoundationDB decouples its data storage technology from its data model. All data is stored as an ordered key-value data structure and can be remapped to custom data models or indexes by using user-written layer module API. FoundationDB doesn’t have any separate query language, it only exposes API to access data.
FoundationDB was famous for having rigorous and thorough testing of their fault tolerance. They built their own [deterministic testing] (https://www.youtube.com/watch?v=4fFDFbi3toc) while developing their system to make sure their system implementation behaves correctly. The simulation was built to model real-life scenarios, such as a combination of transaction executions while having network failure, database configuration change, and human operator errors.[03][05]
History[06][07][08][09]
FoundationDB is built to handle high-load transaction processing with high-performance with strong guarantee (ACID).
FoundationDB is originally built in 2009 by three co-founders, Dave Rosenthal, Dave Scherer, Nick Lavezzo. The founders used to work for Visual Sciences; an analytics company (now is a subsidiary of Adobe). The company acquired Akiban in 2013. FoundationDB was acquired by Apple in 2015. In 2018, Apple open-sourced FoundationDB under Apache License 2.0.
Concurrency Control[10][05][11]
FoundationDB uses Optimistic Concurrency Control (OCC) for writes and Multiversion Concurrency Control (MVCC) for reads. The DBMS only maintains conflicting transaction information for a five second period. Thus, it doesn't support long-running read/write transactions. Conflicting transactions will fail at commit and the client is responsible to retry the transactions.
Data Model[12][13][14]
FoundationDB exposes a single data model, an ordered key-value data model. Both keys and values are byte strings. To support a richer data-model or index, a user can write his own custom layer module API to remap the key-value data model.
Indexes[14]
As have been stated in the Data Model sections, FoundationDB doesn’t support indexes natively. A user needs to build indexes by writing a layer module. With FoundationDB’s transaction, the same transaction can update index and data.
Isolation Levels[15]
FoundationDB uses Optimistic Concurrency Control to achieve Serializable Isolation level. This can be achieved because all modifications to key-value data store are done via transaction.
Logging
FoundationDB only responds to commit request once the transaction has been written to log and fsync-ed to the disk.
Query Interface[16][17]
The only way to model the data and query them is by writing layer. FoundationDB only allows the user to interact with the data through their custom API in Python, Ruby, Java, Go, or C.
The DBMS used to support SQL layer in 2014 but it is not actively supported and maintained anymore.
Storage Architecture[18]
FoundationDB has two storage options, ssd and memory.
All data to be read must reside in memory, and all writes will be written to disk with the number of copies based on the redundancy mode. The default DBMS configuration is memory, and the maximum size of data in memory is 1 GB.
FoundationDB recommends the ext4 filesystem which support for kernel asynchronous I/O.
Storage Organization[20][21]
On ssd mode, FoundationDB stores data with B-tree data structures optimized for SSD. The DBMS gives lower priority to data deletion compared to other normal database operations. Thus, there will be a delay between data deletion and free storage space recovery.
On memory mode, the DBMS constructs its in-memory data structure from stored logs on disk on process start-up.
As of December 2018, FoundationDB is experimenting with new storage engine using multi-version B-tree, called Redwood.
System Architecture[13][22][23][24]
FoundationDB uses shared-nothing architecture. Every time the DBMS writes data, the data is distributed by pieces to different nodes.
FoundationDB has a couple of components to handle scalability:
-
Coordinators: communicate and store a small amount of data for fault-tolerant purposes. Coordinators do not involve in transactions.
-
Cluster Controller: an entry point of all processes in the cluster which is elected by coordinators.
-
Master: coordinates proxies, transactions logs, and resolvers. Master also runs data distribution algorithm and ratekeeper.
-
Proxies: track storage servers, provide read versions, and committing transactions.
-
Transaction Logs: receive commits from the proxy, write and
fsyncdata to the append-only logs on disk, and respond to proxy. Once the data is written to disk, storage servers pop the data from the log. -
Resolvers: hold the last 5 seconds of committed transactions to detect conflicting transactions. The Resolvers make sure the transactions’ read is valid according to MVCC.
-
Storage Servers: store data based on the range of keys assigned. Storage servers keep the freshest data in memory (< 5 seconds old) and the rest of the data are located on disk.
Committing transactions are a sequence of steps achieved by different components:
Master: Provides a commit version to Proxies.
Resolvers: Check whether the current transaction has a conflict with previously committed transactions.
Proxies: Send the valid commits to transactions logs and wait until transaction logs have logged the transaction.
Citations
27 sources- FoundationDB | Home foundationdb.org
- GitHub - apple/foundationdb: FoundationDB - the open source, distributed, transactional key-value store · GitHub github.com
- FoundationDB 7.3.77 — FoundationDB ON documentation github.io
- FoundationDB - Wikipedia wikipedia.org
- Anti-Features — FoundationDB ON documentation github.io
- Apple Acquires Durable Database Company FoundationDB | TechCrunch techcrunch.com
- foundationdb/LICENSE at main · apple/foundationdb · GitHub github.com
- SQL or NoSQL: FoundationDB launches a 'best of both worlds' database | VentureBeat venturebeat.com
- FoundationDB Raises $17 Million in Series A vcnewsdaily.com
- Developer Guide — FoundationDB ON documentation github.io
- Known Limitations — FoundationDB ON documentation github.io
- Data Modeling — FoundationDB ON documentation github.io
- Features — FoundationDB ON documentation github.io
- Layer Concept — FoundationDB ON documentation github.io
- Developer Guide — FoundationDB ON documentation github.io
- API Reference — FoundationDB ON documentation github.io
- SQL layer in FoundationDB - Development / FoundationDB Layers - FoundationDB foundationdb.org
- Configuration — FoundationDB ON documentation github.io
- Administration — FoundationDB ON documentation github.io
- Discussion thread for new storage engine ideas - Development - FoundationDB foundationdb.org
- Configuration — FoundationDB ON documentation github.io
- Fault Tolerance — FoundationDB ON documentation github.io
- Configuration — FoundationDB ON documentation github.io
- FoundationDB Architecture — FoundationDB ON documentation github.io
- https://github.com/apple/foundationdb/commit/e1300053109c984b27070817792534725daea603 github.com
- https://github.com/apple/foundationdb/commit/5f665a199b37160d4d8f8351e6e639091429520a github.com
- https://github.com/apple/foundationdb/commit/c797e35cd003ef28d689e4bb4477c67daf70ddd1 github.com