Move memory limit to lucid, reincrease thread limit
authorSteven Barth <steven@midlink.org>
Fri, 10 Jul 2009 16:39:30 +0000 (16:39 +0000)
committerSteven Barth <steven@midlink.org>
Fri, 10 Jul 2009 16:39:30 +0000 (16:39 +0000)
libs/core/luasrc/init.lua
libs/lucid-http/luasrc/lucid/http/server.lua
libs/lucid/root/etc/config/lucid

index 3297901..dc91a36 100644 (file)
@@ -26,11 +26,6 @@ limitations under the License.
 
 local require = require
 
--- Set memory limit if supported
-if _G.set_memory_limit then
-       set_memory_limit(1024 * 1024 * 1.5)
-end
-
 -- Make sure that bitlib is loaded
 if not _G.bit then
        _G.bit = require "bit"
index 25f2535..4bbec31 100644 (file)
@@ -14,6 +14,7 @@ $Id$
 local ipairs, pairs = ipairs, pairs
 local tostring, tonumber = tostring, tonumber
 local pcall, assert, type = pcall, assert, type
+local set_memory_limit = set_memory_limit
 
 local os = require "os"
 local nixio = require "nixio"
@@ -408,6 +409,11 @@ function Server.process(self, client, env)
        local close = false
        local stat, code, msg, message, err
        
+       env.config.memlimit = tonumber(env.config.memlimit)
+       if env.config.memlimit and set_memory_limit then
+               set_memory_limit(env.config.memlimit)
+       end
+
        client:setsockopt("socket", "rcvtimeo", 5)
        client:setsockopt("socket", "sndtimeo", 5)
        
index b9be1dd..c5a3f3d 100644 (file)
@@ -1,6 +1,6 @@
 config lucid main
        option pollinterval 15000
-       option threadlimit 2
+       option threadlimit 10
        option daemonize 1
        option debug 0
        list supports tcpserver
@@ -30,6 +30,7 @@ config daemon http
        list publisher webroot
        list publisher luciweb
        option nokeepalive 1
+       option memlimit 1572864
        option enabled 1
        
 config daemon https
@@ -38,6 +39,7 @@ config daemon https
        list publisher webroot
        list publisher luciweb
        option nokeepalive 1
+       option memlimit 1572864
        option enabled 1
        option tls maincert
        option encryption enable