-
Thayumanavar S authored
This is backport of WL#7195 to MySQL-5.5. In 5.5, we offload connection authentication from the acceptor thread to tp worker threads. Connection authentication happens in the acceptor thread that accepts the connection for thread pool plugin. Connection authentication involves exchanging packets with client and disk I/O which is time consuming. This can cause other client connections to starve and wait in the queue possibly increasing the connect latency and decreasing throughput. In the worst case, some connections could be dropped. n addition, SSL handshakes are quite expensive and can stall connections in the accept queue. This patch offloads connection authentication when thread pool plugin is used for client connection. Each thread group shall have a queue of connection_context objects, which represents new connections that need to be processed by thread group threads. The connection context is composed of THD object & list pointers for intrusive queue implementation. Whenever a new connection arrives, connection context object is created and added to the queue. A new connect handler thread is created or woken up to handle the authentication task. The worker thread loop is modified to process connection events on connect handler threads in addition to checking for query processing events. The initial number of connect handler threads is one per thread group and it is restricted to a maximum of 4 threads per thread group.
35809da2