Optimizing a bounded-memory KV store