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 3297901accd3f96fd1bc926c4e8db27e9d1d009b..dc91a36a0f03d2600d987e2deb6bd259d270342d 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 25f2535d99ad66be276bf19744f472f787433a09..4bbec31a1389090cd54bff7b4cd527be42f1a447 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 b9be1dd975d04423ef1b6aaf732568bf48c36190..c5a3f3d8eee4111491d891b1a5cdac66aff0bbe1 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