ToroDB internals: open source Java database middleware under the hood
summary
ToroDB Stampede is an open‑source Java8 middleware (≈150,000 LOC) that live-replicates MongoDB into a pure relational schema without predefining tables, mapping nested documents to many tables and reconstructing documents via internal IDs. Core tech includes Netty for protocol I/O with off‑heap ByteBufs, Akka Streams for a backpressured replication pipeline, and Chronicle Queue for durable off‑heap buffering. DDL during streaming uses a stop‑the‑world rollback-and-retry strategy; string interning + Guava cuts memory use from gigabytes to ~300MB; analytics show 10–100× faster queries.
AI-written summary · about
chapters (13)
- 0:00Introduction and context
- 1:27What is ToroDB
- 5:43Live demonstration
- 12:20Architecture overview
- 17:47Document to table mapping
- 23:14Replication pipeline
- 28:32DDL changes handling
- 34:49Parallel operations applier
- 39:01Memory and performance optimizations
- 45:25Sharding support
- 47:12Dependency injection challenges
- 51:31Testing with Docker and JUnit 5
- 54:09Q&A: Initial sync and consistency
