Connection Management •On Unix, the same manager thread also handles Unix socket file connection requests. •On Windows, one manager thread handles shared-memory connection requests, and another handles named-pipe connection requests. •On all platforms, an additional network interface may be enabled to accept administrative TCP/IP connection requests. This interface can use the manager thread that handles “ordinary”  TCP/IP requests, or a separate thread. •X Plugin enables MySQL Server to communicate with clients using X Protocol. See Section 20.5, “X Plugin” . The server does not create threads to handle interfaces that it does not listen to. For example, a Windows server that does not have support for named-pipe connections enabled does not create a thread to handle them. Individual server plugins or components may implement their own connection interface: Client Connection Thread Management Connection manager threads associate each client connection with a thread dedicated to it that handles authentication and request processing for that connection. Manager threads create a new thread when necessary but try to avoid doing so by consulting the thread cache first to see whether it contains a thread that can be used for the connection. When a connection ends, its thread is returned to the thread cache if the cache is not full. In this connection thread model, there are as many threads as there are clients currently connected, which has some disadvantages when server workload must scale to handle large numbers of connections. For example, thread creation and disposal becomes expensive. Also, each thread requires server and kernel resources, such as stack space. To accommodate a large number of simultaneous connections, the stack size per thread must be kept small, leading to a situation where it is either too small or the server consumes large amounts of memory. Exhaustion of other resources can occur as well, and scheduling overhead can become significant. MySQL Enterprise Edition includes a thread pool plugin that provides an alternative thread-handling model designed to reduce overhead and improve performance. It implements a thread pool that increases server performance by efficiently managing statement execution threads for large numbers of client connections. See Section 5.6.3, “MySQL Enterprise Thread Pool” . To control and monitor how the server manages threads that handle client connections, several system and status variables are relevant. (See Section 5.1.8, “Server System Variables” , and Section 5.1.10, “Server Status Variables” .) •The  thread_cache_size  system variable determines the thread cache size. By default, the server autosizes the value at startup, but it can be set explicitly to override this default. A value of 0 disables caching, which causes a thread to be set up for each new connection and disposed of when the connection terminates. To enable  N  inactive connection threads to be cached, set thread_cache_size  to  N  at server startup or at runtime. A connection thread becomes inactive when the client connection with which it was associated terminates. •To monitor the number of threads in the cache and how many threads have been created because a thread could not be taken from the cache, check the  Threads_cached  and  Threads_created  status variables. •When the thread stack is too small, this limits the complexity of the SQL statements the server can handle, the recursion depth of stored procedures, and other memory-consuming actions. To set a stack size of  N  bytes for each thread, start the server with  thread_stack  set to  N . 983