Block Cache, Page Cache, and Multi-Tenant Memory Density
2832 words ~14 mins

#rocksdb #database #storage #memory #rust
If every tenant on a host runs its own RocksDB, you have to pick how their memory is shared. The page-cache route lets the OS arbitrate but charges decrypt and decompress on every read. The block-cache route is dramatically faster (37x on point reads against a 10 GB working set with a 1 GiB cache, in the run below) but pushes the arbitration problem back onto you, which is why the first non-trivial piece of the design ends up being a custom allocator.

Killing Cache-Line Contention with Sharded Counters
1731 words ~9 mins

#rust #concurrency #performance #atomics
A single hot AtomicU64 forces every writer to bounce the same cache line between cores. Sharding the counter across cache-line-padded atomics turns a contended fetch_add into uncontended local writes, at the cost of an O(SHARDS) read.

Convert hasNext style iterator to C++ Range
412 words ~2 mins

#c++ #ranges
Key-value stores provide a generic API to store and retrieve values using the key. In this post, we will see how relational tables can be mapped to key-value stores.

Copy Elision in C++
855 words ~5 mins

#c++
Key-value stores provide a generic API to store and retrieve values using the key. In this post, we will see how relational tables can be mapped to key-value stores.