From 832835dc3a991fb81ac7e5cc3e28d0035a01e4e1 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Fri, 20 Jun 2014 06:36:57 -0700 Subject: [PATCH] Updated Optimizing Shadowsocks (markdown) --- Optimizing-Shadowsocks.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Optimizing-Shadowsocks.md b/Optimizing-Shadowsocks.md index 7c725b7..28564de 100644 --- a/Optimizing-Shadowsocks.md +++ b/Optimizing-Shadowsocks.md @@ -1,5 +1,7 @@ On Debian 7: +If you see a lot of `error: too many open files` in your log, you should optimize your system. + Create `/etc/sysctl.d/local.conf` with the following content: ``` @@ -33,6 +35,14 @@ Then: Warning: **DO NOT ENABLE `net.ipv4.tcp_tw_recycle`!!!** See [this article](http://vincent.bernat.im/en/blog/2014-tcp-time-wait-state-linux.html). +If you use [Supervisor](https://github.com/clowwindy/shadowsocks/wiki/Configure-Shadowsocks-with-Supervisor), Make sure you have the following line in `/etc/default/supervisor`. Once you added that line, restart Supervisor. + +``` +ulimit -n 51200 +``` + +If you use other ways to run shadowsocks in the background, make sure to add `ulimit -n 51200` in your init script. + After optimizing, Shadowsocks should be able to handle thousands of connections with about 20MB memory and < 10% CPU. ![if_eth0-day](https://cloud.githubusercontent.com/assets/1073082/3280283/2fc1c782-f454-11e3-8cec-75e1615e6ca8.png)