]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Increase listen backlog to deal with request spikes 552/head
authorSteven Hartland <steven.hartland@multiplay.co.uk>
Thu, 30 Oct 2014 15:43:07 +0000 (15:43 +0000)
committerSteven Hartland <steven.hartland@multiplay.co.uk>
Thu, 30 Oct 2014 15:52:00 +0000 (15:52 +0000)
In order to deal with transient request spikes don't limit the
connection backlog to 10 instead use a default appropriate to
the OS.

For FreeBSD and Mac OS this is -1 (system default) for everything
else this is 511 which will get truncated back to the OS max.

src/rrd_daemon.c

index f34d08af1373496bc5ed8e26dec443d6274ed082..5eb4c774a67bd8b147af27261a30ac716d480f25 100644 (file)
     syslog ((severity), __VA_ARGS__); \
   } while (0)
 
+#if defined(__FreeBSD__) || defined(__APPLE__)
+#define RRD_LISTEN_BACKLOG -1
+#else
+#define RRD_LISTEN_BACKLOG 511
+#endif
+
 /*
  * Types
  */
@@ -3215,7 +3221,7 @@ static int open_listen_socket_unix (const listen_socket_t *sock) /* {{{ */
           (unsigned int)sock->socket_permissions, strerror(errno));
   }
 
-  status = listen (fd, /* backlog = */ 10);
+  status = listen(fd, RRD_LISTEN_BACKLOG);
   if (status != 0)
   {
     fprintf (stderr, "rrdcached: listen(%s) failed: %s.\n",
@@ -3350,7 +3356,7 @@ static int open_listen_socket_network(const listen_socket_t *sock) /* {{{ */
       continue;
     }
 
-    status = listen (fd, /* backlog = */ 10);
+    status = listen(fd, RRD_LISTEN_BACKLOG);
     if (status != 0)
     {
       fprintf (stderr, "rrdcached: listen(%s) failed: %s\n.",