nexus_db · C++17 compiled to WebAssembly

An LSM tree you can crash

The real storage engine from src/db.cpp, writing a real write-ahead log and real SSTable files into an in-memory filesystem. Write until the memtable flushes, read keys back through the files, then crash it without a clean shutdown and watch the log bring the writes back.

Write

Read

Memtable

The flush threshold is a constructor argument; changing it reopens the database.

Lifecycle


    

On disk

    Newest first, the order a read searches them. Click a file to decode it.

    Inside a file

    #keyvalue

    Benchmark, inside WebAssembly

    Sequential writes into a fresh database with the default 1 MB memtable, then mean latency of point reads. The same shape as ./nexus_db natively, where the README has the numbers. Disk reads here are slower than native ones: every file read goes through Emscripten's JavaScript filesystem layer rather than the kernel.

    runs on the page's main thread, so the page pauses while it works