BUG/MEDIUM: init/threads: consider epoll_fd/pipes for automatic maxconn calculation
authorWilly Tarreau <w@1wt.eu>
Thu, 14 Mar 2019 18:13:17 +0000 (19:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 14 Mar 2019 19:02:37 +0000 (20:02 +0100)
This is the equivalent of the previous patch for the automatic maxconn
calculation. This doesn't need any backport.

src/haproxy.c

index b7979ea..28c72a5 100644 (file)
@@ -1478,6 +1478,12 @@ static int compute_ideal_maxconn()
        /* subtract listeners and checks */
        remain -= global.maxsock;
 
+       /* one epoll_fd/kqueue_fd per thread */
+       remain -= global.nbthread;
+
+       /* one wake-up pipe (2 fd) per thread */
+       remain -= 2 * global.nbthread;
+
        /* Fixed pipes values : we only subtract them if they're not larger
         * than the remaining FDs because pipes are optional.
         */