Bandwidth throttling

René Cannaò edited this page Dec 15, 2017 · 1 revision

ProxySQL 1.4.4 introduces 2 new bandwidth throttling:

  • from ProxySQL to client
  • from MySQL server to ProxySQL

Bandwidth throttling from ProxySQL to client

In ProxySQL 1.4.4 a new global variable named throttle_max_bytes_per_second_to_client was added. This variable defines the maximum number of bytes per second sent to a client.
Note that currently this is only a global variable: it affects every single client connection, no matter from where hostgroup the resultset is coming, neither how many clients are connected.
This feature is useful to limit the bandwidth used between the client and proxysql, for example to avoid the financial penalty of purchasing an expensive committed information rate from an Internet service provider.

  • Minimum value: 1024 (1KB/s)
  • Maximum value: 2147483647 (2GB/s)
  • Default value: 2147483647 (2GB/s)

Bandwidth throttling from MySQL server to ProxySQL

In order to be able to perform query retry in case a backend connection is terminated while sending resultset, ProxySQL buffers mysql-threshold_resultset_size bytes coming from the backend before starting data to the client. That means that ProxySQL is able to perform query retry only for queries that return a small resultset.
When a big resultset is send from the backend to ProxySQL and mysql-threshold_resultset_size threshold is reached, ProxySQL will immediately start sending data to the client.
A problem arises if the client is not able to proceed data at the same rate in which the backend is sending it, for example if the client uses some high level driver or ORM. If this happens, historically ProxySQL would normally buffer all the resultset sent by the backend, waiting the client to retrieve it, leading to a potential OOM.
In ProxySQL 1.4.4 the data flow was optimized so that if more than 8 x mysql-threshold_resultset_size bytes are already buffered in ProxySQL and still not sent to the client, ProxySQL will pause retrieving data from the backend unless the client will start consuming the buffered data.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.