My Little Showdown: Bolt vs Nakashima
Alright, let’s talk about something I tinkered with recently. Needed a simple key-value thing, something embedded, no big server setup. Just for a little side project I was hacking together in my garage, you know, keeping track of sensor readings from a gadget I built.

So first, I grabbed BoltDB, or ‘bolt’ as most folks call it. Heard good things, seemed straightforward. Getting it running was pretty quick, I’ll give it that. I downloaded the library, wrote a few lines of Go code to open a file, create a bucket, stuff like that.
My process went something like this:
- Opened the database file. Easy enough.
- Started a write transaction. Okay, felt a bit formal, but safe.
- Put some keys and values in. Simple byte slices, no big deal.
- Committed the transaction. Done.
- Then tried reading stuff back. Started a read transaction, fetched the data. Worked fine.
It felt solid, you know? Like using a proper tool. Transactions made me feel like my data wasn’t going to get messed up if the power flickered. But maybe a bit… chunky? For just storing simple timestamp-value pairs, all those transaction blocks felt like overkill sometimes.
Then, a buddy mentioned this other approach, he called it the ‘nakashima’ way, mostly because it was inspired by some old code structure he saw that reminded him of Nakashima joinery – super simple, direct, minimal locking. It wasn’t really a library, more like a pattern using basic file I/O and some clever indexing he’d cooked up. I was curious, thought maybe it’d be faster, less ceremony.
So, I spent an afternoon trying to replicate this ‘nakashima’ idea. Forget transactions. It was more like:
- Open a file directly.
- Append new data straight to the end.
- Keep a separate little index file, mapping keys to offsets in the main data file.
- Reading meant looking up the offset in the index, then seeking in the data file.
It felt really raw. Super fast for just dumping data, no question. Appending is quick. But reading involved jumping around the file. And handling updates or deletes? Man, that got messy fast. You’d have to mark entries as deleted or compact the file periodically. Concurrent writes? Forget about it, basically needed external locking around the whole thing. It was simple, yes, but also kinda fragile.
After playing with both for a few days on my little sensor project, I just went back to Bolt. The ‘nakashima’ approach was interesting, maybe good for write-once, read-many scenarios where you control everything tightly. But Bolt just felt safer, more robust for general use. Even for my simple needs, knowing those transactions were handling the consistency gave me peace of mind. The slight overhead was worth not worrying about data corruption if my gadget crashed mid-write.
So yeah, Bolt won out for me in this little comparison. Not because ‘nakashima’ was bad, just different. Bolt felt like a reliable hammer, ‘nakashima’ felt like crafting a tool from scratch – cool, but more work and risk involved for my particular job.
