WL#9252: X Protocol connection compression

Affects: Server-8.0   —   Status: Complete

Motivation

Latency of requests on networks depends on:

  • networks RTT
  • utilization of the network

While the networks RTT can't be changed, the utilization of the network can be changed by compressing the packets to reduce the traffic.

In context of the xprotocol most of the data that's transferred are:

  • statement text (strings)
  • resultset data (strings, numbers, ...)

which both should be nicely compressible.

CPU latency vs. network latency trade-off

Compression uses CPU time to encode the data and to decode the data. Sending less data over the network allows to reduce network utilization and therefore the extra latency added due to overloaded network.

Compression algorithms

While zlib/deflate have been the de-facto compression algorithm in network protocols, in the recent years new algorithms where developed that compress faster, compress better and/or are more CPU efficient. To support add new algorithms over time, the server should announce which algorithms it can understand.

Clients may support zero or more of the servers compression algorithms and should select one that fits the users requirements best.

DR1
make compression algorithm negotiable

Impact on middleboxes

(middleboxes like MySQL Router, ...)

Middleboxes like Routers/Load-Balancers need to track the state of the protocol flow to make decisions to which backend should be sent and when the connection enters a bad state. That's done by tracking the message headers and error messages and notices.

If a middlebox must decompress all messages to be able to track state they may get CPU bound and overloaded and slow down the communication between client and server.

DR2
middleboxes MUST be able to read message headers without noticeable overhead if the data is compressed.

Security Considerations

DR3
To prevent DoS each side MUST apply limits on the uncompressed payload before decompression.