Apache web server: Kill process/thread automatically that consumes too much RAM

mp flag

We're running an Apache web server (version 2.4.51 on Debian 11) which delivers a huge website with lots of scripts, all written in Perl. The problem is that no one can can really figure out how the code works and the functionality is being continuously replaced by new software written in PHP. Sometimes though the old Perl code runs into a loop, starts consuming too much RAM and the Apache web server is killed by the Kernel's OOM killer. This doesn't happen quite often, but when it happens someone has to login to the server and restart Apache, which costs precious time as the website delivers important functionality to the users.

The requirement is to configure the Apache web server so that the thread(s), that has run into a loop gets killed before the OOM killer kills the Apache parent process. All other Apache threads should continue to run, only the one that consumes too much RAM should be removed/terminated by Apache itself or some Systemd cgroup functionality (or some other means if there is one).

How is it possible to meet this requirement?

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.