3

I have a linux server that I use for many things. One of the most important is a apache web server. Sometimes other applications use a major part of the memory and the apache server don't work fine. There is a method to allocate a minimum amount of memory for apache? For example if I have 8GB RAM and I want apache always have 5 GB allocated and the system and the others applications cannot use more than 3 GB. Is this possible? Thank you very much!

antiks
  • 263
  • 5
  • 14

2 Answers2

0

I think you need to restrict MaxRequestsPerChild. Might be this is helpful

https://serverfault.com/questions/112361/limit-apache-2-memory-usage

Community
  • 1
  • 1
0

Is your server swapping? What is your swap usage? Use:

$ cat /proc/swaps

to check it out.

If it's not swapping it's probably not a memory usage that is causing problems. If it is swapping then there are two things you can do:

  • Add more memory
  • Reduce memory usage

There is no sane way in Linux to "reserve memory" or prevent process from being swapped out.

Erki Aring
  • 2,032
  • 13
  • 15
  • There actually is a way to prevent process from being swapped out, described here: http://stackoverflow.com/questions/578137/can-i-tell-linux-not-to-swap-out-a-particular-processes-memory . In your case it probably means patching Apache to lock whole Apache processes into RAM, which goes beyond the "sane" threshold, IMHO – Erki Aring Aug 06 '14 at 09:01