We have developed our first database, a Basic In-Memory Key/Value Store. While simple, it has some similarities to actual production in-memory key/value stores such as Redis. Further, it does correctly implement concurrent read and write requests through multi-threading with locking.
In the project, benchmarking is performed and we find that read heavy workloads do significantly benefit from multi-threading while write heavy workloads only get a modest boost in total performance. You can find more details in the project write up, including a discussion of why this may be the case.
One thing that I find particularly surprising is that
has similar performance as
in all of the tested scenarios.
As discussed in the project, it is generally thought that
is superior due using
an internal structure composed of multiple distinct segments, each with their own lock. In contrast
just has a single global lock. Further,
is developed to allow
lock-less read operations, including
get(key). In the
write up we consider why these two
implementations may demonstrate similar performance.
I found this project quite enjoyable to develop and I learned more than I expected. I hope that you too can learn something from it also. Next, we're going to develop a disk-backed key/value store to provide actual persistence. This will introduce some new challenges and I'm quite excited to solve them. I hope to have that finished in the next week so check back soon.