Whoops! I Rewrote it in Rust
summary
Rewrites Pelikan pieces in Rust, starting with a tokio/mio networking prototype and boringssl TLS, then replaces the C storage by implementing a single‑threaded segment storage rewrite that cuts metadata to ~5 bytes per item and needs ~two months of work. Benchmarks initially show a 10–15% throughput drop and ~25–30% higher p39, but the final Rust storage matches or beats C at high load and achieves ~93% DRAM perf on Optane PMEM (4:1 R/W). Uses cargo bench and cargo fuzz.
AI-written summary · about
chapters (16)
- 0:00Intro
- 2:11Pelikan • open source caching framework • single codebase • multiple solutions
- 2:43Use Rust to: • add Transport Layer Security (TLS) • match performance of Cimplementation
- 3:42Rust Storage in Pelikan: 2018 Engineer wants to add storage to Pelikan and write the library in Rust . Used the framework with FFI to use Rust Storage • First commit of Rust to Pelikan!
- 4:23Rust Server in Pelikan: 2019 Engineer wants to use Rust for server code • Tokio / async server • Reuse components for Storage / Parser/Buffers/Metrics
- 5:16Performance Testing Apply synthetic workloads with ratelimit to measure latency at a specific requestrate
- 7:54Performance Problems . Throughput 10-15% slower a need more instances to match throughput requirements . Latency 25-30% higher l@p999/99.9th Percentile
- 13:13Prototype • Memcached protocol compatible • wrapped std::collections::HashMap as temporary storage • benchmarking looked good • next step: FFI for storage library
- 16:36Whoops! All Rust • Implemented new research storage design
- 19:53Rust Tooling Benefits • cargo bench & criterion o microbenchmarking of critical components
- 24:45Sorting by TTL • Enables efficient eager expiration no need to expire on read • New eviction strategies o closest to expiration
- 28:31PMEM Support • Intel Optane Persistent Memory IPMEMI • Metadata in DRAM
- 30:02Next Steps Path to Production • feature complete • more testing • production canary • deployment
- 31:01Rewriting: Costs and Benefits Costs • Extra time would have caused missed deadlines • Duplicating work that's been paid for
- 31:36Cand Rust are both very fast Profiling and benchmarking helped get us match the performance of the implementation
- 32:45Pelikan has an exciting future with Rust!
related talks
27mWhoops! I Rewrote It in Rust
01h 02mRewriting of a small component from C to Rust
42mRewrite It In Rust: Can We RIIR Everything?
31mBenchmarking and Optimization of Rust Libraries
46mAdopting Rust by gracefully oxidising web applications
33mRewrite, Optimize, Repeat
33mRust at Sentry: 7 Years Later
59mRust in Production
