MySQL之back_log

来源:互联网 发布:金融大数据分析 编辑:程序博客网 时间:2024/06/08 15:03
做mysql多线程并发时遇到高人提及back_log ,遂google且译之,文笔粗糙,随意喷

The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time. It then takes some time (although very little) for the main thread to check the connection and start a new thread. The back_log value indicates how many requests can be stacked during this short time before MySQL momentarily stops answering new requests. You need to increase this only if you expect a large number of connections in a short period of time.
In other words, this value is the size of the listen queue for incoming TCP/IP connections. Your operating system has its own limit on the size of this queue. The manual page for the Unix listen() system call should have more details. Check your OS documentation for the maximum value for this variable. back_log cannot be set higher than your operating system limit.


back_log标记MySQL的并发连接数。在MySQL主线程短时间内收到大量连接请求时会涉及back_log ,然后主线程在一段时间(或者瞬间)后检查连接数,并启动新线程。back_log 的值表示:MySQL(处理大量请求时,由于满负荷)暂时停止回复新请求前能够堆放的请求数。如果用户希望短时间内有更大的连接数,应该增大back_log 的值。
换言之,back_log 的值表示监听的TCP/IP连接队列的大小。当然,操作系统也有自己的队列大小限制。Unix手册中对于listen()的系统调用会提供细节。如需要,可以检查操作系统文档中关于该值最大值的说明。back_log  不能大于操作系统限制的最大值。
原创粉丝点击