Increase listen_backlog by default (to match default in newer linux kernel)

It was 64 for a long time, and even linux kernel never has such a small
limit, it had 128 (net.core.somaxconn sysctl).

But recently, in 5.4, the default value had been increased even in
linux kernel, to 4096 [1].

  [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=19f92a030ca6d772ab44b22ee6a01378a8cb32d4

Let's increase it in ClickHouse too.

Also note, that I've looked through some instances with
clickhouse-server only, and TcpExtListenOverflows was non zero (`nstat
-za`), in other words backlog of the listen socket indeed overflowed
there.

So it is better to increase the default to move the problem to
clickhouse-server itself (yes you will unlikely have 4K new incomming
connections at one time, with accept thread do not accept them all, but
still seems that it is possible, maybe due to some locks or something
else).
This commit is contained in:
Azat Khuzhin 2021-10-01 21:03:59 +03:00
parent 27f6d5864d
commit 9d69786a6b

View File

@ -343,7 +343,7 @@ Poco::Net::SocketAddress Server::socketBindListen(Poco::Net::ServerSocket & sock
LOG_DEBUG(&logger(), "Requested any available port (port == 0), actual port is {:d}", address.port());
}
socket.listen(/* backlog = */ config().getUInt("listen_backlog", 64));
socket.listen(/* backlog = */ config().getUInt("listen_backlog", 4096));
return address;
}