From 7ba12e9c5eafd809237fa69464e8b601926e9513 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Fri, 10 Jul 2009 16:39:30 +0000 Subject: Move memory limit to lucid, reincrease thread limit --- libs/core/luasrc/init.lua | 5 ----- libs/lucid-http/luasrc/lucid/http/server.lua | 6 ++++++ libs/lucid/root/etc/config/lucid | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libs/core/luasrc/init.lua b/libs/core/luasrc/init.lua index 3297901ac..dc91a36a0 100644 --- a/libs/core/luasrc/init.lua +++ b/libs/core/luasrc/init.lua @@ -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" diff --git a/libs/lucid-http/luasrc/lucid/http/server.lua b/libs/lucid-http/luasrc/lucid/http/server.lua index 25f2535d9..4bbec31a1 100644 --- a/libs/lucid-http/luasrc/lucid/http/server.lua +++ b/libs/lucid-http/luasrc/lucid/http/server.lua @@ -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) diff --git a/libs/lucid/root/etc/config/lucid b/libs/lucid/root/etc/config/lucid index b9be1dd97..c5a3f3d8e 100644 --- a/libs/lucid/root/etc/config/lucid +++ b/libs/lucid/root/etc/config/lucid @@ -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 -- cgit v1.2.3