
How I Built a Crash-Safe Database Engine in C with Write-Ahead Logging and Snapshots
Most developers use databases every day. Few actually know what happens when the power goes out mid-write, or when a system crashes halfway through saving data. Yet when the database restarts, everything is still there. That reliability isn’t magic. It comes from careful engineering. I wanted to understand this at a deeper level, so I built RadishDB. It started as a simple in-memory key–value store in C. Over time, I added persistence, crash recovery, write-ahead logging, snapshots, TTL expiration, a TCP server, and Docker deployment. The goal wasn’t to compete with Redis. It was to understand how systems like Redis actually work under the hood. Why C? Since RadishDB is fundamentally a storage engine, performance and predictability matter a lot. I wanted full control over memory and disk behavior. C gives you: direct control over memory no garbage collector predictable performance minimal abstraction between code and hardware When you're building a database, memory layout and disk writ
Continue reading on Dev.to
Opens in a new tab


