libapa...esource(3pm)
π NAME π
Apache2::Resource β bestie, this is how you cap the resources your httpd children are allowed to eat. Limits, but make it cute. No cap.
β¨ SYNOPSIS β¨
Okay so this is the whole vibe, drop it in and go:
PerlModule Apache2::Resource
# set child memory limit in megabytes
# default is 64 Meg
PerlSetEnv PERL_RLIMIT_DATA 32:48
# linux does not honor RLIMIT_DATA
# RLIMIT_AS (address space) will work to limit the size of a process
PerlSetEnv PERL_RLIMIT_AS 32:48
# set child cpu limit in seconds
# default is 360 seconds
PerlSetEnv PERL_RLIMIT_CPU 120
PerlChildInitHandler Apache2::Resource
That's it. That's the setup. π
πΈ DESCRIPTION πΈ
So Apache2::Resource is out here using the BSD::Resource module, and that module is using the C function setrlimit to set limits on system resources β think memory, think cpu usage. It's giving "parental controls but for processes."
Any RLIMIT operation your system is able to limit? You can set it by defining that operation as an environment variable with a PERL_ prefix. Periodt. Wanna know which resources are available to limit? Go read your system's setrlimit manpage, bestie, it's all in there.
Also important bestie lore: these limit values are in megabytes: DATA, RSS, STACK, FSIZE, CORE, MEMLOCK. Every other one gets treated as its natural unit. π
Now, if the value of the variable is shaped like S:H? Then S is the soft limit and H is the hard limit. Soft and hard, like two different moods, both valid. If it's just a single number, that one number is used for both the soft and the hard limit. Simple. Iconic.
π DEFAULTS π
Wanna set reasonable defaults for all the RLIMITs? Not me setting up defaults for every single one, slay. Add this to your httpd.conf:
PerlSetEnv PERL_RLIMIT_DEFAULTS On
PerlModule Apache2::Resource
π¦ SEE ALSO π¦
π COPYRIGHT π
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0. Legal girlies, do your thing.
π AUTHOR π
Doug MacEachern β the main character. π«Ά
Okay that's the whole page, bestie, you're so welcome π This was libapa...esource(3pm), part of the User Contributed Perl Documentation, from perl v5.42.3, dated 2026-08-20. Go forth and limit responsibly! πβ¨
π¦ where this page comes from
- ubuntu stonking: libapache2-mod-perl2 2.0.13-2build3 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms