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.


svn:r13625
This commit is contained in:
Peter Palfrader 2008-02-20 22:28:09 +00:00
parent 384a8ab777
commit 644452a62f
3 changed files with 33 additions and 3 deletions

12
debian/changelog vendored
View File

@ -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@debian.org> Wed, 20 Feb 2008 23:27:35 +0100
tor (0.2.0.19-alpha-1) experimental; urgency=low
* New upstream version.

9
debian/tor.default vendored
View File

@ -9,10 +9,15 @@ RUN_DAEMON="yes"
#
# 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

15
debian/tor.init vendored
View File

@ -25,7 +25,20 @@ TORPID=$TORPIDDIR/tor.pid
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