diff options
author | Thayumanavar S <thayumanavar.x.sachithanantha@oracle.com> | 2017-01-30 03:16:09 +0100 |
---|---|---|
committer | Thayumanavar S <thayumanavar.x.sachithanantha@oracle.com> | 2017-01-30 03:16:09 +0100 |
commit | 35809da2077e913eda7da75aec674593c74238af (patch) | |
tree | 791c3e013cd12b757b961320a5d0ecfdacf050a4 /sql/sql_class.cc | |
parent | 01ea63b3cb967fbaf0f8a9dd74c359ba0084889a (diff) | |
download | mariadb-git-35809da2077e913eda7da75aec674593c74238af.tar.gz |
WL#10287 - Backport WL#7195 to MySQL - 5.5
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.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index d9fda85d8f6..4a5ac006e32 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -385,6 +385,7 @@ THD *thd_get_current_thd() */ void thd_new_connection_setup(THD *thd, char *stack_start) { + thd_lock_thread_count(thd); #ifdef HAVE_PSI_INTERFACE if (PSI_server) thd_set_psi(thd, |