Capstone: Benchmark against real Redis

Rust closes most of the gap to C Redis. Typical: Python 10-50k ops/s, Go 40-100k, our Rust server 50-150k, real Redis 50-200k. The architecture is identical. Constant-factor implementation choices are the lever.

10-capstone/src/main.rs
rust
for i in 0..n {
    let key = format!("k:{i}");
    let val = format!("v:{i}");
    let cmd = encode_array_strings(&["SET", &key, &val]);
    let t = Instant::now();
    socket.write_all(&cmd).await?;
    read_reply(&mut socket, &mut buf, &mut tmp).await?;
    set_stats.record(t.elapsed().as_micros());
}

Sequential RESP load. One connection, N SETs followed by N GETs, p50/p95/p99 reported per phase.

Where the gap to real Redis comes from

Architecture is identical. Constant factors: zero-copy IO, hand-tuned hash table, no allocator overhead.

How to close the gap without changing architecture: bytes::BytesMut for zero-copy parsing, dashmap for lock-free reads, pipelining (multi-command per write), io_uring on Linux. Each is a focused exercise.