• Stars
    star
    1,323
  • Rank 34,275 (Top 0.7 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 2 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Distributed, MVCC SQLite that runs on FoundationDB.

mvSQLite

Distributed, MVCC SQLite that runs on top of FoundationDB.

Documentation

Features

  • Full feature-set from SQLite: mvSQLite integrates with SQLite as a custom VFS layer. It is a layer "below" SQLite, and all of SQLite's features are available.
  • Time travel: Checkout the snapshot of your database at any point of time in the past.
  • Lock-free, scalable reads and writes: Optimistic fine-grained concurrency with BEGIN CONCURRENT-like semantics. mvSQLite inherits FoundationDB's lock-free property - not a single distributed lock is acquired during data plane operation.
  • Get the nice properties from FoundationDB, without its limits: Correctness, really fast and scalable distributed transactions, synchronous and asynchronous replication, integrated backup and restore. Meanwhile, there's no five-second transaction limit any more, and a SQLite transaction can be ~39x larger than FDB's native transaction.
  • Drop-in addition: Use LD_PRELOAD or a patched libsqlite3.so to plug mvSQLite into your existing apps. Read the docs

Releases

Grab the latest binaries from the Releases page. You can also build your own binaries to run on a platform other than x86-64.

Quick reference

Check the single-page mvSQLite Quick Reference for common operations with mvSQLite.

Try it

Install FoundationDB:

wget https://github.com/apple/foundationdb/releases/download/7.1.15/foundationdb-clients_7.1.15-1_amd64.deb
sudo dpkg -i foundationdb-clients_7.1.15-1_amd64.deb
wget https://github.com/apple/foundationdb/releases/download/7.1.15/foundationdb-server_7.1.15-1_amd64.deb
sudo dpkg -i foundationdb-server_7.1.15-1_amd64.deb

Download the binaries:

curl -L -o ./libmvsqlite_preload.so https://github.com/losfair/mvsqlite/releases/download/v0.2.1/libmvsqlite_preload.so
curl -L -o ./mvstore https://github.com/losfair/mvsqlite/releases/download/v0.2.1/mvstore
chmod +x ./mvstore

Run mvstore, the server-side half that should be colocated with the FoundationDB cluster in production:

RUST_LOG=info ./mvstore \
  --data-plane 127.0.0.1:7000 \
  --admin-api 127.0.0.1:7001 \
  --metadata-prefix mvstore \
  --raw-data-prefix m

Create a namespace with the admin API:

curl http://localhost:7001/api/create_namespace -i -d '{"key":"test"}'

Build libsqlite3 and the sqlite3 CLI: (note that a custom build is only needed here because the sqlite3 binary shipped on most systems are statically linked to libsqlite3 and LD_PRELOAD don't work)

wget https://www.sqlite.org/2023/sqlite-amalgamation-3410000.zip
unzip sqlite-amalgamation-3410000.zip
cd sqlite-amalgamation-3410000
gcc -O2 -fPIC --shared -o libsqlite3.so ./sqlite3.c -lpthread -ldl -lm
gcc -O2 -o sqlite3 ./shell.c -L. -lsqlite3

Set environment variables, and run the shell:

export RUST_LOG=info MVSQLITE_DATA_PLANE="http://localhost:7000"

# "test" is the key of the namespace we created earlier
LD_PRELOAD=../libmvsqlite_preload.so LD_LIBRARY_PATH=. ./sqlite3 test

You should see the sqlite shell now :) Try creating a table and play with it.

Contributing

mvsqlite can be built with the standard Rust toolchain:

cargo build --release -p mvstore
cargo build --release -p mvsqlite
make -C mvsqlite-preload

Internals are documented in the wiki.

More Repositories

1

blueboat

All-in-one, multi-tenant serverless JavaScript runtime.
Rust
1,917
star
2

RefineDB

A strongly-typed document database that runs on any transactional key-value store.
Rust
387
star
3

IceCore

Application container built for WebAssembly
Rust
111
star
4

wasm-core

Portable WebAssembly implementation intended to run everywhere
Rust
81
star
5

dlock

Distributed-Lock-as-a-Service implemented on Cloudflare Durable Objects.
TypeScript
59
star
6

rust-coroutines

Stackful coroutine library for Rust that "just works"
C
49
star
7

Violet

Superscalar RISC-V processor written in Clash.
Haskell
34
star
8

v8-serde

[WIP] Pure-JavaScript implementation of the V8 value serializer
TypeScript
32
star
9

vmesh

VMesh is a decentralized Layer 3 mesh router and protocol designed for open network interconnection.
Go
30
star
10

AlphaBoard

An HTML5 web app for teaching
JavaScript
25
star
11

hexagon-e

The HexagonE VM
Rust
24
star
12

sqlite-cache

SQLite-based on-disk cache for Rust.
Rust
23
star
13

FlatRv

A cross-platform RISC-V interpreter that implements the RV32IMA instruction set.
Rust
19
star
14

MagiCore

An out-of-order processor that supports multiple instruction sets.
Scala
18
star
15

ice-node

Node bindings for the Ice Web Framework
C++
16
star
16

AlphaTrans

An extremely fast accelerator for block transfer in unstable networks
C++
13
star
17

notion-fetch

A Cloudflare Workers service that fetches and renders Notion pages as HTML, Markdown, or JSON.
TypeScript
12
star
18

minichat

Distributed real-time chat demo on Blueboat in 15 lines of JavaScript
JavaScript
10
star
19

unproxy

Map TCP services behind an HTTP(S) proxy to local ports.
Rust
10
star
20

rm-protection-c

rm-protection implemented in C
C
10
star
21

caddy-watch

Watch for interesting patterns in Caddy logs and send a Telegram notification.
Go
9
star
22

pbft-rs

Practical Byzantine Fault Tolerance implemented in Rust.
Rust
8
star
23

b6t

Minimal containerized Blueboat suitable for self-hosting.
Shell
8
star
24

lambda-box

λ-box 是一个运行在 Blueboat 上的匿名提问箱 app.
TypeScript
8
star
25

mvps

Log-structured, transactional virtual block device backed by S3
Rust
8
star
26

kvm-sandbox

Sandbox for trustless execution, implemented with KVM.
C++
7
star
27

wstunnel

IP over WebSocket.
Rust
7
star
28

bsync

Incremental, multi-version remote backup tool for block devices.
Rust
7
star
29

edp

An implementation of the Erlang Distribution Protocol in Rust.
Rust
7
star
30

avalanche-demo

Demos of how the Avalanche family consensus protocols (Slush, Snowflake, Snowball and Avalanche) work.
TypeScript
6
star
31

blog

Source code for my personal site.
TypeScript
6
star
32

metamachine

Experimental CPU with software-defined instruction set.
VHDL
5
star
33

supernova

A control plane for the Nebula overlay networking system.
TypeScript
5
star
34

FlatMk-v0

The FlatMk Microkernel.
Rust
5
star
35

NextHDL

symbolic evaluation == circuit synthesis
Rust
5
star
36

smr

Multi-process scheduler for managed runtimes.
Rust
5
star
37

liquid-layout

A layout engine that solves UI constraints using the Z3 prover.
Rust
5
star
38

fdb2kafka

Ship consistent logs from FoundationDB to Kafka.
Go
5
star
39

hexagon

Rust
5
star
40

elfpromote

A small utility for modifying ELF shared library loading order.
Rust
5
star
41

gkv

Geo-replicated eventually-consistent KV store
Scala
5
star
42

jslinux-wstunnel

JSLinux (https://bellard.org/jslinux/) ported to use wstunnel (https://github.com/losfair/wstunnel) for networking.
JavaScript
5
star
43

lazyproxy

A TCP proxy that is so lazy that shuts down itself after a period of inactivity.
Rust
5
star
44

luax

A Lua 5.3 implementation in Rust (work in progress)
Rust
4
star
45

tsotest

Test Total Store Ordering status on your CPU.
Rust
4
star
46

bbcp

Multi-user control plane service for Blueboat.
TypeScript
4
star
47

violet-cosim

Cosimulator for the Violet core: https://github.com/losfair/Violet
Rust
4
star
48

blueboat-examples

Example apps running on Blueboat.
JavaScript
4
star
49

liblightning

High-performance general-purpose stackful coroutine library
Rust
4
star
50

fediblog

Personal site (v2)
TypeScript
4
star
51

bbcli

Command line tool for deploying and managing apps on Blueboat.
Rust
4
star
52

rCore-SoC-2020

Code and documentation for rCore "OS Tutorial Summer of Code 2020".
Rust
4
star
53

mips

Single-cycle and pipelined MIPS CPUs written for learning purpose. Written in 12 hours.
Verilog
4
star
54

blueboat-mds

Blueboat Metadata Service is a distributed metadata manager for Blueboat.
JavaScript
4
star
55

boat

[WIP] CLI for MagicBoat.
Rust
3
star
56

cloudkernel

Distributed usermode hypervisor for modern workloads.
C++
3
star
57

bluesched

Blueboat cluster scheduler.
Elixir
3
star
58

ops

My collection of scripts for operating services, databases and systems.
Shell
3
star
59

hgw

A "secure enclave" I run at home
Go
3
star
60

awesome-blueboat

A curated collection of web apps on the Blueboat engine.
3
star
61

gluon

[WIP] Launch selfhosted apps in one click with mvSQLite and Fly.io
TypeScript
3
star
62

jftp

Just Forward The Port
Rust
3
star
63

OxygenMark

C++
3
star
64

particles-rs

Particles effects implemented in Rust and running on the WebAssembly platform
Rust
3
star
65

node-multithread

Multithread for Node.js
C++
3
star
66

Presenter.js

Present your slides easily, with remote control.
JavaScript
2
star
67

morf

MoRF is a mutually-authenticated, encrypted communication protocol over lossy packet links with small MTUs
Rust
2
star
68

notion-blueboat

Notion website on Blueboat.
2
star
69

caddy-log-kafka

A Caddy log writer that writes logs to Kafka.
Go
2
star
70

tunnelme

A selfhosted tunnel service.
Haskell
2
star
71

mips-x

Another MIPS32 CPU. My course design for Computer Organization @ NUAA, 2020 Spring.
Verilog
2
star
72

bfjit-osr

Brainfuck JIT for demonstrating On-Stack Replacement technology.
Rust
2
star
73

naptd

Rust
2
star
74

caddy-log-to-mysql

Import Caddy logs to MySQL for analysis.
Rust
2
star
75

pl0-jit

JIT compiler targeting x86-64 for PL/0. Homework.
Rust
2
star
76

DeepDark

Process manager for Linux servers
C++
2
star
77

rvjit-aa64

RISC-V static binary translator targeting AArch64.
Rust
2
star
78

blueanalytics

Self-hosted web analytics for Caddy + Blueboat.
TypeScript
1
star
79

TextSharing

Text Sharing
1
star
80

retls

Re-encrypt TLS connection with a different certificate
Rust
1
star
81

CloudEdu

A light web app for education.
JavaScript
1
star
82

UniMessTunnel

Go
1
star
83

bdtts-go

Unofficial Baidu TTS API for Golang
Go
1
star
84

SharpIce

C# web framework based on Ice Core
C#
1
star
85

OxygenMark-PageEngine

OxygenMark PageEngine
JavaScript
1
star
86

html2md

A fork of https://gitlab.com/Kanedias/html2md .
Rust
1
star
87

wavebpf-hw

Haskell
1
star
88

orange-rs

Hardware support crate for OrangeSoC.
Rust
1
star
89

FutureCore-Terminal

Terminal control & VM for FutureCore
C
1
star
90

pyice_base

C++
1
star
91

magicore-aas

MagiCore as a Service (https://github.com/losfair/MagiCore)
Rust
1
star
92

losfair

1
star
93

dockerfiles

My collection of dockerfiles.
Dockerfile
1
star
94

virtual-dom-rs

Rust
1
star
95

blurry

[WIP] Toy GPT frontend written in Haskell that runs on Deno
1
star