vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.66k stars 2.1k forks source link

VTTablet allocation reduction #17172

Open harshit-gangal opened 1 week ago

harshit-gangal commented 1 week ago

Bellow is the VTTablet allocation space flame graph.

image

image

image

Query Result to Proto conversion and MySQL packets to Row conversion takes almost ~43% space.

This can be avoided with the new grpc codec2 that allows Buffers to be passed through to grpc transport layer without additional allocation.

We will utilize this codec2 by skipping row packets parsing at VTTablet and also not converting them from Query Result to proto using the grpc mem.BufferSlice. This reduction in allocation should reflect in out allocation and cpu time leading to better query latency.

We might see little higher unmarshal time at VTGate for converting raw packets to result rows. But it will outweight the benefits of avoiding at VTTablet.

More graphs will be updated after doing a POC.

arthurschreiber commented 3 days ago

Nice! I'm really excited about the change to skip mysql packet parsing at the vttablet level. 🎉