Bug #62288 THD initialization too expensive for accept() thread
Submitted: 28 Aug 2011 22:10 Modified: 8 Aug 2013 18:02
Reporter: Domas Mituzas Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Locking Severity:S5 (Performance)
Version:5.1, 5.5 OS:Any
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D3 (Medium)

[28 Aug 2011 22:10] Domas Mituzas
Description:
In a high connections-per-second workload THD initializer as well as THD::init() are too expensive for main thread.

Most of that work should be moved to worker threads. 

How to repeat:
connect a lot to MySQL

Suggested fix:
move initialization to worker threads, use THD as stub object with only data needed to start working on it.
[8 Aug 2013 18:02] Paul Dubois
Noted in 5.7.2 changelog.

Previously, the main loop responsible for accepting client
connections also performed initialization of data structures related
to each connection. These initialization tasks now are delegated to
worker threads to minimize work done by the accept loop and maximize
connection acceptance rate.

As a result of this change, the bind_address, thread_cache_size, and
thread_handling system variables no longer have any effect in the
embedded server (libmysqld). Similarly, the Slow_launch_threads and
Threads_cached status variables are not meaningful in the embedded
server. These variables are no longer visible within the embedded
server and embedded applications that rely on these variables should
be modified accordingly.