> I am currently using Apache::Resource to limit the maximum amount of ram > the apache childs are allowed to use.
It would be better to use Apache::SizeLimit for that. It's more flexible and allows requests to complete before shutting down the process. Apache::Resource is more useful as a safety measure to catch runaway processes. > However, I can't really use PERL_RLIMIT_CPU because it is kind of pointless > to kill every apache child that reaches > this limit. I need a way to restrict cpu time on a per script or per run > basis. But I am not sure if this is possible as > far as I understand the mod_perl layout. > Anybody did this? Or any suggestions? That isn't possible without some modification to apache. You would need to be able to check the CPU consumed in some asynchronous way as the request was processed, and there's no provision for that in the current apache process model. > My second problem is related to this one. How can I add perlcode via > httpd.conf (PerlModule, ...) which is > reevaluated at EVERY request? All you need is a handler. Every request can run as many handlers as you configure in each stage. If you're asking how to assign a handler globally for every request, just use <LocationMatch *> or something similar. > I am thinking about adding some own perl code > which sets an alarm an > checks every now an than how much cpu time the currently running perl > script allready got I don't think you can do that. There are warnings in perlipc about how having a complex alarm handler can cause segfaults. Honestly, if all you're trying to do is keep coding mistakes from crashing your server with a tight loop, just set some reasonable limit with Apache::Resource. When there's no problem, apache children don't generally use much CPU at all. That means runaways really stand out and use up their allotted CPU limit quickly. > Some other probleme here. How do I tell mod_perl to execute abc.pl inside > the current scope but without > saving the compiled code or any variables? You can't. You can remove the entries from the symbol table after running it (see Apache::PerlRun for an exmaple), but why do you want to do this? If you're just trying to save RAM, load the script at startup. If it's huge and you don't usually need it, tell the current process to exit when it's finished with this request. - Perrin