[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [Sandboxed Lua] Limit execution time, loop iterations and memory usage
- From: moltrecht@...
- Date: Wed, 9 Jun 2010 10:35:32 +0200 (CEST)
Thanks you for all your answers, I managed to limit CPU time and memory using the "ulimit" command.
But now there is a performance issue. I ran some tests on the current testing system and found out that launching the Lua parser (from my PHP script) takes around 0.02 seconds, almost exactly the time it takes to calculate the sine 100.000 times. Since the sandboxed Lua is supposed to be ran a few times for each PHP site parsed, this may cause serious performance problems (0.02s for intepreter + 0.02s for script = 0.04s, 0.04s * 10 = 0.4s, and this is just the Lua part, without any MySQL or PHP).
Is there any possibility of running the interpreter all the time and just sending it commands which scripts to execute and then stream the output back to my PHP script? This would eliminate the need to start the interpreter again and again.
Your help would really be appreciated,
Von: "Patrick Donnelly" <firstname.lastname@example.org>
Gesendet: Dienstag, 8 Juni, 2010 16:33
An: "Lua list" <email@example.com>
Betreff: Re: [Sandboxed Lua] Limit execution time, loop iterations and memory usage
On Tue, Jun 8, 2010 at 10:30 AM, Kurt Nordstrom
> Also, look at the debugging hooks in the C API.
> I'd be interested in seeing a good solution to limiting memory
There is a good solution, give Lua an allocator that has a limit on
the amount of memory .
- Patrick Donnelly