You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2022/01/27 15:06:55 UTC

svn commit: r1897551 - /httpd/httpd/trunk/server/mpm/event/event.c

Author: ylavic
Date: Thu Jan 27 15:06:55 2022
New Revision: 1897551

URL: http://svn.apache.org/viewvc?rev=1897551&view=rev
Log:
mpm_event: Use APR_POLLEXCL when available to prevent thundering hurd.

If APR_POLLEXCL is available, use it to prevent the thundering
herd issue. The listening sockets are potentially polled by all
the children at the same time, when new connections arrive this
avoids all of them to be woken up while most would get EAGAIN
on accept().


Modified:
    httpd/httpd/trunk/server/mpm/event/event.c

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1897551&r1=1897550&r2=1897551&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Thu Jan 27 15:06:55 2022
@@ -2699,6 +2699,15 @@ static void setup_threads_runtime(void)
         pfd = &listener_pollfd[i];
 
         pfd->reqevents = APR_POLLIN | APR_POLLHUP | APR_POLLERR;
+#ifdef APR_POLLEXCL
+        /* If APR_POLLEXCL is available, use it to prevent the thundering
+         * herd issue. The listening sockets are potentially polled by all
+         * the children at the same time, when new connections arrive this
+         * avoids all of them to be woken up while most would get EAGAIN
+         * on accept().
+         */
+        pfd->reqevents |= APR_POLLEXCL;
+#endif
         pfd->desc_type = APR_POLL_SOCKET;
         pfd->desc.s = lr->sd;