Bug #62283 accept() socket gets too much of fcntl()s
Submitted: 28 Aug 2011 21:55 Modified: 8 Aug 2013 18:05
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 21:55] Domas Mituzas
Description:
On avery accept MySQL does:

get flags fnctl()
set flags to nonblocking fcntl()
accept()
set flags to blocking fcntl()

when it can just set socket to nonblocking once and run accepts forever on it 

How to repeat:
connect to MySQL 

Suggested fix:
set socket to nonblocking at start, just call accepts directly on it
[8 Aug 2013 18:05] 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.