News for hackers. Stuff that matters.
Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by the_mitsuhiko on Monday January 11, 2016 @09:23AM (#10880866)
> Removing the dependency is just one part of the story. Another part is that requests per second under heavy load increased from ~400 to ~850! Also, all those weird errors were gone – using BoltDB with 10k concurrent users we get zero errors.

Not exactly surprising. Redis is single threaded so if you will need to spawn multiple instances if you want to satisfy all cores. Which is what I assume is happening here.

Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by antirez on Monday January 11, 2016 @09:29AM (#10880911)
I'm not sure what the user did with Redis, but it's unlikely that you can saturate a core with, like, 1000 requests/sec unless you do complex/slow operation. But apparently the OP was just doing simple ops because otherwise the switch to BoltDB could be impossible or harder. So I guess there is something to dig to understand what was happening. The most likely cause is the execution of many fast commands in Redis without a pipeline, so that all the time was burn in RTTs.

EDIT: Anyway for my programming philosophy, what the OP did, regardless of performances, totally makes sense. I think easy to use and deploy is a key value in software ;-)

Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by ploxiln on Monday January 11, 2016 @11:47AM (#10881502)
There can often be issues with managing pools of tcp connections in clients - locking around accessing the pool, corner cases in state/lifetime of a connection in the pool, etc. In my experience with other databases and languages anyway.
Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by andrewguenther on Monday January 11, 2016 @01:44PM (#10882236)
I just did some digging on their Github, for every captured HTTP request there is one Redis/Bolt op and for every replay there is one get Redis/Bolt op.

You should be able to pipeline the recording, but likely not the get operations.

Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by Loic on Monday January 11, 2016 @09:37AM (#10880946)
I am using BoltDB in production. BoltDB is wonderful for mostly read operations, if you perform a lot of read/write operations, Redis will at the end be better because of the B-tree of BoltDB and the way the pages are handled (the author and the docs do not hide this, heavy read is the use case).

What I take from his post is that his software was nicely designed to be able to easily change the backend which will allow him to easily switch back to Redis in the future when he will get corruption from BoltDB because of the intensive read/write which is not the use case.

Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by ddorian43 on Monday January 11, 2016 @11:17AM (#10881283)
BoltDB is based on LMDB which is supposed to never be corrupted, so if they based it right they'll be fine.
Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by justin66 on Monday January 11, 2016 @06:27PM (#10884450)
They share no code at all.
Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by benbjohnson on Monday January 11, 2016 @09:28PM (#10885191)
The fundamental design of Bolt is the same as LMDB though. The premise behind why LMDB is "uncorruptable" is that all the dirty data pages for a transaction are written out first followed by a write to a double-buffered meta page that points to the new root of the B+tree.

If any data page is partially written then it doesn't matter because the new meta page hasn't been written to point to it. If the new meta page is partially written then it is detected through a checksum and the previous meta page is used (thereby rolling back the transaction). That's how Bolt works as well.

That being said, all code has bugs (yes, even LMDB). Bolt has a large amount of test coverage as well as randomized black box testing that it uses to help minimize those bugs.

Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by hyc_symas on Wednesday January 13, 2016 @05:04AM (#10893311)
Just for the record, LMDB uses both random testing as well as explicitly targeted test cases. (I.e., we construct a DB with specific data in specific sequences to trigger splits and rebalances, etc.) Test coverage is over 90%, with the remainder being auxiliary and platform-specific code. (I.e., we cannot get 100% coverage on any single box due to segments of the code that are #ifdef'd for some other platform.)
Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by justin66 on Tuesday January 12, 2016 @10:45AM (#10888039)
That's a really good explanation of the db's function, thanks.

Are you guys still single process? That killed a few pretty important lmdb use cases. I've always been curious why you did that.

Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by Loic on Tuesday January 12, 2016 @08:24AM (#10887218)
The corruption I was talking about is this one: https://github.com/boltdb/bolt/issues/348
Re:Replacing Redis with BoltDB – A Pure Go Key/Value Store by deforciant on Monday January 11, 2016 @09:43AM (#10880976)
In case of Hoverfly, it never needs read/write operations, it only writes during "capture" mode and then only reads during "virtualize" mode and that's when performance really counts, so it looks like a perfect solution.