Apache using all 16 GB Memory, how to limit its processes and memory usage?
<p>We are on 16GB AWS instance and I am finding it to be really slow. When I ran </p>

<pre><code>ps -aux | grep apache
</code></pre>

<p>I can see about 60+ apache processes. </p>

<p><a href="https://i.stack.imgur.com/IPKy3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IPKy3.jpg" alt="enter image description here"></a></p>

<p>When I ran</p>

<pre><code>watch -n 1 "echo -n 'Apache Processes: ' &amp;&amp; ps -C apache2 --no-headers | wc -l &amp;&amp; free -m"
</code></pre>

<p>It is showing almost all memory being used by apache.</p>

<p><a href="https://i.stack.imgur.com/Nb6Ul.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nb6Ul.png" alt="enter image description here"></a></p>

<p>When I ran</p>

<pre><code>curl -L https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | perl
</code></pre>

<p>to see how to optimize Apache, it suggested me to increase number of MaxRequestWorkers so I made it 550. I also changed MaxConnectionsPerChild from 0 (unlimited) to 10000. </p>

<p>Here is my /etc/apache2/mods-enabled/mpm_prefork.conf file</p>

<pre><code>&lt;IfModule mpm_prefork_module&gt;
        StartServers              5
        MinSpareServers           5
        MaxSpareServers          10
        MaxRequestWorkers        550
        MaxConnectionsPerChild   10000
&lt;/IfModule&gt;
</code></pre>

<p>Can you tell me how can we optimize apache memory usage so it don't bring down the whole site down ? </p>