Skip to content

Commit

Permalink
Merge pull request #130 from Comcast/split-ulimit-from-kernel-limit
Browse files Browse the repository at this point in the history
Split the ulimit value from the kernel limit value.
  • Loading branch information
schmidtw authored Mar 1, 2019
2 parents d9dec70 + b97efff commit 46bc394
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions etc/caduceus/caduceus.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#KERNEL_OPEN_FILES=95000
#ULIMIT_OPEN_FILES=75000
#NET_CORE_SOMAXCONN=1000
#NET_IPV4_TCP_MAX_SYN_BACKLOG=1000
Expand Down
13 changes: 7 additions & 6 deletions etc/init.d/caduceus
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ RETVAL=0

# Set limits here in addition to limits.conf
#-------------------------------------------------------------------------------
if [ -n "$ULIMIT_OPEN_FILES" ]; then
sysctl -w fs.file-max=$ULIMIT_OPEN_FILES > /dev/null
if [ -n "$KERNEL_OPEN_FILES" ]; then
sysctl -w fs.file-max=$KERNEL_OPEN_FILES > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "fs.file-max=$ULIMIT_OPEN_FILES failed" && exit $RETVAL
[ $RETVAL -ne 0 ] && echo "fs.file-max=$KERNEL_OPEN_FILES failed" && exit $RETVAL

sysctl -w fs.nr_open=$ULIMIT_OPEN_FILES > /dev/null
sysctl -w fs.nr_open=$KERNEL_OPEN_FILES > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "fs.nr_open=$ULIMIT_OPEN_FILES failed" && exit $RETVAL

[ $RETVAL -ne 0 ] && echo "fs.nr_open=$KERNEL_OPEN_FILES failed" && exit $RETVAL
fi
if [ -n "$ULIMIT_OPEN_FILES" ]; then
ulimit -n $ULIMIT_OPEN_FILES > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "ulimit -n $ULIMIT_OPEN_FILES failed" && exit $RETVAL
Expand Down

0 comments on commit 46bc394

Please sign in to comment.