6.9.5. Using the Max Connections Feature
This feature will allow the connector behavior to be changed based on the
connection count. The connector is able to mimic MySQL's
max_connections. Depending on your needs, the connector
can be configured to pile up or reject connections above this number. This
is served by the following two tpm flags:
--connector-max-connections - defines the
maximum number of connections the connector should allow at any time.
connector-max-connections is set
to a non-zero numeric value, the connector denies access to the client in
one of two ways: queue (default) or reject.
defines how the connector should handle new connection requests - queue
(default) or reject.
Enabling this option causes the connector to drop new connection requests
connector-max-connections is reached
by immediately sending a "Too Many Connections" error to the client, just
like MySQL would.
When a client connection request arrives at the connector, an object is
created to track that client connection which uses a certain amount of
The connector then checks the value of
connector-max-connections against the
current connection count.
If the connection limit has been reached, the connector decides how to
behave by checking the value of
is false (the default), the connector will queue the connection request,
but send nothing back to the client at all. This connection check will
repeat after a delay. Once the connection count falls below
connector-max-connections an attempt to
connect to a server is made. In this mode, connections will continue to
pile up in memory as new requests are queued, resulting in an Out of
Memory error. For this reason, the
available to prevent connection queueing when the maximum number of
connections has been reached.
is enabled, the connector will return a "Too Many Connections" error to
the client and remove the client connection object, freeing memory.
./tools/tpm configure alpha --connector-max-connections=2500
must also set a non-zero value for
./tools/tpm configure alpha --connector-max-connections=2500 --connector-drop-after-max-connections=true
Updating these values require a connector restart (via tpm update) for the
changes to be recognized.
To select a real-world value for
connector-max-connections, set the value to
a value slightly lower than the MySQL value of
max_connections to prevent the server from ever hitting
maximum. You may use the following formula for a more complex calculation:
connector-max-connections = ( MySQL Master
max_connections / number of connectors ) * 0.95
is enabled, be sure that your load balancers are configured to identify
that max connections have been reached and to switch to another connector
when that happens.