RLimitMEM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I'm running Apache httpd-2.3 on a 64-bit machine running CentOS (Linux Kernel 2.6.18-92.1.22.el5 SMP). It is configured to run PHP scripts using suPHP so that user scripts run as PHP-CGI processes. In my scenario, we provide hosting services to a number of users who are hosted using Name-based mass virtual hosting. Recently, we noticed some users using a lot of memory through their PHP processes. So, we decided to restrict the memory usage per CGI process instance.

I added the following line to the Apache config:

RLimitMEM 15360000 20480000

However, after adding this line, even simple PHP applications stopped working. So, I raised the soft limit to be 20M and still no luck. The apache error logs show the following line:
[Fri Oct 09 12:47:41 2009] [error] [client 192.168.4.45] /usr/lib/bin/php-cgi: error while loading shared libraries: libaspell.so.15: failed to map segment from shared object: Cannot allocate memory,
[Fri Oct 09 13:31:08 2009] [error] [client 192.168.4.45] /usr/lib/bin/php-cgi: error while loading shared libraries: librt.so.1: failed to map segment from shared object: Cannot allocate memory

So, clearly 20M is not enough as well. I kept on increasing the value (in steps of 20M) and finally the script was successfully able to load all the shared libraries when it was allowed 100MB of space.

So, if I understand correctly, Apache's RLimitMEM directive uses the virtual memory size of the process to apply this limit. Is there a standard way to estimate the limit that RLimitMEM should enforce?

Is there any alternative to RLimitMEM that does not take virtual memory size into account but rather the Resident Set Size or the private memory of those processes?

Thanks and regards
Chandranshu

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux