[or-cvs] r13625: Change the default for MAX_FILEDESCRIPTORS in our init scrip (tor/trunk/debian)

weasel at seul.org weasel at seul.org
Wed Feb 20 22:28:09 UTC 2008


Author: weasel
Date: 2008-02-20 17:28:09 -0500 (Wed, 20 Feb 2008)
New Revision: 13625

Modified:
   tor/trunk/debian/changelog
   tor/trunk/debian/tor.default
   tor/trunk/debian/tor.init
Log:
Change the default for MAX_FILEDESCRIPTORS in our init script to depend on the
number of system-wide available file descriptors: /proc/sys/fs/file-max is
bigger than 100k, set ulimit -n to 32k, if it's smaller than 20k set it to
1024.  Big servers at the moment regularly use more than 10k FDs, so our old
default of 8k no longer is sufficient.  On the other hand we don't want lower
end systems to run out of FDs on Tor's account.


Modified: tor/trunk/debian/changelog
===================================================================
--- tor/trunk/debian/changelog	2008-02-20 21:57:48 UTC (rev 13624)
+++ tor/trunk/debian/changelog	2008-02-20 22:28:09 UTC (rev 13625)
@@ -1,3 +1,15 @@
+tor (0.2.0.19-alpha+svn-1) unreleased; urgency=low
+
+  * Change the default for MAX_FILEDESCRIPTORS in our init script to depend
+    on the number of system-wide available file descriptors:
+    /proc/sys/fs/file-max is bigger than 100k, set ulimit -n to 32k, if it's
+    smaller than 20k set it to 1024.  Big servers at the moment regularly use
+    more than 10k FDs, so our old default of 8k no longer is sufficient.  On
+    the other hand we don't want lower end systems to run out of FDs on Tor's
+    account.
+
+ -- Peter Palfrader <weasel at debian.org>  Wed, 20 Feb 2008 23:27:35 +0100
+
 tor (0.2.0.19-alpha-1) experimental; urgency=low
 
   * New upstream version.

Modified: tor/trunk/debian/tor.default
===================================================================
--- tor/trunk/debian/tor.default	2008-02-20 21:57:48 UTC (rev 13624)
+++ tor/trunk/debian/tor.default	2008-02-20 22:28:09 UTC (rev 13625)
@@ -9,10 +9,15 @@
 
 #
 # Servers sometimes may need more than the default 1024 file descriptors
-# if they are very busy and have many clients connected to them.
+# if they are very busy and have many clients connected to them.  The top
+# servers as of early 2008 regularly have more than 10000 connected
+# clients.
 #  (ulimit -n)
 #
-MAX_FILEDESCRIPTORS=8192
+# (the default varies as it depends on the number of available system-wide file
+#  descriptors.  See the init script in /etc/init.d/tor for details.)
+#
+# MAX_FILEDESCRIPTORS=
 
 #
 # If tor is seriously hogging your CPU, taking away too much cycles from

Modified: tor/trunk/debian/tor.init
===================================================================
--- tor/trunk/debian/tor.init	2008-02-20 21:57:48 UTC (rev 13624)
+++ tor/trunk/debian/tor.init	2008-02-20 22:28:09 UTC (rev 13625)
@@ -25,7 +25,20 @@
 DEFAULTSFILE=/etc/default/$NAME
 WAITFORDAEMON=60
 ARGS=""
-MAX_FILEDESCRIPTORS=8192
+# Let's try to figure our some sane defaults:
+if [ -r /proc/sys/fs/file-max ]; then
+	system_max=`cat /proc/sys/fs/file-max`
+	if [ "$system_max" -gt "100000" ] ; then
+		MAX_FILEDESCRIPTORS=32768
+	elif [ "$system_max" -gt "20000" ] ; then
+		MAX_FILEDESCRIPTORS=8192
+	else
+		MAX_FILEDESCRIPTORS=1024
+	fi
+else
+	MAX_FILEDESCRIPTORS=8192
+fi
+
 NICE=""
 
 test -x $DAEMON || exit 0



More information about the tor-commits mailing list