Readyset is a MySQL and Postgres wire-compatible caching layer that sits in front of existing databases to speed up queries and horizontally scale read throughput. Under the hood, ReadySet caches the results of cached select statements and incrementally updates these results over time as the underlying data changes.
When looking at a flamegraph produced while running a system-benchmark, I discovered that we spend a lot of time in PacketReader::next() just resizing the backing Vec<u8>. There's more efficient ways to handle the buffer here. Naively, we should look at the bytescrate as it integrates with tokio natively.
This code in PacketReader is fairly self-contained so any optimization should be rather straight forward.
Description
When looking at a flamegraph produced while running a
system-benchmark
, I discovered that we spend a lot of time inPacketReader::next()
just resizing the backingVec<u8>
. There's more efficient ways to handle the buffer here. Naively, we should look at thebytes
crate as it integrates withtokio
natively.This code in
PacketReader
is fairly self-contained so any optimization should be rather straight forward.Change in user-visible behavior
N/A
Requires documentation change
N/A