A resource constraint changes if we have green threads. Adapt.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 1 Oct 2012 03:51:14 +0000 (23:51 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 1 Oct 2012 03:51:14 +0000 (23:51 -0400)
irkerd

diff --git a/irkerd b/irkerd
index 4e2f9ba5f1646d61646bfd7503be3d0defc94da5..2e37bd1f981cc191579d06e305955927a93871d5 100755 (executable)
--- a/irkerd
+++ b/irkerd
@@ -35,7 +35,6 @@ UNSEEN_TTL = 60                       # Time to live, seconds since first request
 CHANNEL_MAX = 18               # Max channels open per socket (default)
 ANTI_FLOOD_DELAY = 0.125       # Anti-flood delay after transmissions, seconds
 ANTI_BUZZ_DELAY = 0.09         # Anti-buzz delay after queue-empty check
-CONNECTION_MAX = 200           # Avoid pushing per-process thread or fd limits
 
 # No user-serviceable parts below this line
 
@@ -46,7 +45,16 @@ CONNECTION_MAX = 200         # Avoid pushing per-process thread or fd limits
 try:
     import eventlet; eventlet.monkey_patch()
     green_threads = True
+    # With greenlets we don't worry about thread exhaustion, only the
+    # file descriptor limit (typically 1024 on modern Unixes). Thus we
+    # can handle a lot more concurrent sessions and generare less
+    # join/leave spam under heavy load.
+    CONNECTION_MAX = 1000
 except ImportError:
+    # Threads are more expensive if we have to use OS-level ones
+    # rather than greenlets.  We need to avoid pushing thread limits
+    # as well as fd limits.  See security.txt for discussion.
+    CONNECTION_MAX = 200
     green_threads = False
 
 import sys, json, getopt, urlparse, time, random