From 63b3b40abf054bce2846bc9e36770a6ed2791a8b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 9 Apr 2011 18:58:23 -0700 Subject: increase RLIMIT_NPROC for thread-crazy folks Might as well, threads are free and cheap on 64-bit --- lib/rainbows/http_server.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/rainbows/http_server.rb') diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb index 21c5a05..02f3405 100644 --- a/lib/rainbows/http_server.rb +++ b/lib/rainbows/http_server.rb @@ -52,6 +52,13 @@ class Rainbows::HttpServer < Unicorn::HttpServer # 5: std{in,out,err} + heartbeat FD + per-process listener nofile = 5 + @worker_connections + LISTENERS.size trysetrlimit(:RLIMIT_NOFILE, nofile) + + case @use + when :ThreadSpawn, :ThreadPool, :ActorSpawn, + :CoolioThreadSpawn, :RevThreadSpawn, + :WriterThreadPool, :WriterThreadSpawn + trysetrlimit(:RLIMIT_NPROC, @worker_connections + LISTENERS.size + 1) + end super end -- cgit v1.2.3-24-ge0c7