From: Eric S. Raymond Date: Mon, 1 Oct 2012 03:51:14 +0000 (-0400) Subject: A resource constraint changes if we have green threads. Adapt. X-Git-Tag: 1.3~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=83e8da1827f5b9bf35ec15834f7ece78eb7151a8;p=irker.git A resource constraint changes if we have green threads. Adapt. --- diff --git a/irkerd b/irkerd index 4e2f9ba..2e37bd1 100755 --- 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