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 πŸ¦‹


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