docs::a...esource(3)
πΈ NAME πΈ
okay bestie, welcome to the docs::a...esource(3) page β it's giving βkeep httpd children from eating the whole serverβ energy, and honestly? iconic. Apache2::Resource is here to Limit resources used by httpd children. periodt. π
β¨ Synopsis β¨
here's the whole config vibe, exactly as it appears, no edits bestie:
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
like, the comments are literally part of the lore: child memory limit in megabytes, default is 64 Meg; child cpu limit in seconds, default is 360 seconds; and yes, linux does not honor RLIMIT_DATA, but RLIMIT_AS (address space) will work to limit the size of a process. slay. π¦
π¦ Description π¦
so Apache2::Resource uses the BSD::Resource module, and that module uses the C function setrlimit to set limits on system resources such as memory and cpu usage. highkey useful. β¨
any RLIMIT operation available to limit on your system can be set by defining that operation as an environment variable with a PERL_ prefix. see your system setrlimit manpage for available resources which can be limited. iykyk. π«Ά
the following limit values are in megabytes: DATA, RSS, STACK, FSIZE, CORE, MEMLOCK; all others are treated as their natural unit. no cap. π
if the value of the variable is of the form S:H, then S is treated as the soft limit, and H is the hard limit. if it is just a single number, it is used for both soft and hard limits. the way that's so clean. π
π Defaults π
to set reasonable defaults for all RLIMITs, add this to your httpd.conf:
PerlSetEnv PERL_RLIMIT_DEFAULTS On
PerlModule Apache2::Resource
boom β reasonable defaults, handled. π
π See Also π
π Copyright π
mod_perl 2.0 and its core modules are copyrighted under the Apache Software License, Version 2.0. legal moment, but make it cute. π
π Author π
Doug MacEachern β author, legend, main character. πβ¨
okay that's the whole page, bestie! this one's from perl v5.42.3, dated 2023-10-21, and the page title is docs::a...esource(3) β mwah πβ¨
π¦ where this page comes from
- nixos 26.05: mod_perl 2.0.13
- nixpkgs unstable: mod_perl 2.0.13
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms