In MySQL 6.0 a threadpool design was implemented based on
libevents and mutexes.
This design unfortunately had a number of deficiences:
1) The performance under high load was constrained due to a
global
mutex protecting libevent (see BUG#42288).
2) The design had no flexibility to handle cases where threads
were
blocked due to either locking or latches. E.g. a thread held up
by a
table lock will be kept in the threadpool as an active thread
until
the table lock is released. If all threads are blocked in this
state,
it's easy to see that also any query that want to release the
table
lock cannot be processed since all threads in the thread pool
are
blocked waiting for the table lock (see BUG#34797).
3) The design is intended to support very many connections
but
didn't use the most efficient methods to do this on
Windows.
…
This blog describes background and implementation of a poll
set to monitor many sockets in one or several receive
threads. The blog is intended as a description but also to
enable some feedback on the design.
I've been spending some time working out all the gory
details
of starting and stopping lots of send threads, connection
threads and receive threads over the last few months.
The receive threads will be monitoring a number of socket
connections and as soon as data is available ensure that
the data is received and forwarded to the proper user
thread for execution.
However listening on many sockets is a problem which needs
a scalable solution. Almost every operating system on the
planet has some solution to this problem. The problem is
that they all have different solutions. So I decided to
make a simple interface to those socket …