1. IMPORTANT - 11/13/2015: In light of a possible breach we have scrubbed all passwords. You will need to request a password reset through the site. Click here for more information.

How to prevent memory exhaustion while using Apache Keep Alive?

Discussion in 'Web Server' started by postcd, Apr 29, 2014.

  1. postcd

    postcd Member

    Apr 16, 2014
    Likes Received:

    my virtual openvz VPS server crashed and there was sign it was exhausted memory. I have Keep Alive enabled.

    Any advices on how to prevent memory over use because of example http attack with many connections?

  2. VitalkaDrug

    VitalkaDrug Member

    Oct 11, 2013
    Likes Received:
    I think you should try to limit the number of running processes of Apache (the options depend from used Apache concurrency model) and play with timeouts.

    For example, I set the following values on my VPS:
    Timeout 15
    MaxKeepAliveRequests 30
    KeepAliveTimeOut 3
    StartServers 1
    MinSpareServers 1
    MaxSpareServers 2
    MaxClients 10
    MaxRequestsPerChild 100

    In my case the most important are:
    1. MaxClients that limit the number of child Apache processes
    2. MaxRequestsPerChild that doesn't allow to grow to Apache's memory consumption

    But I don't have a lot of connections simultaneously :) My site works for personal usage only. So you should set values according your requirements. Try to monitor how growing the number of running Apaches and memory consumption on your VPS in depend from the number of visitors.
  3. Ankit Chugh

    Ankit Chugh New Member

    May 9, 2014
    Likes Received:
    nice suggestions.... yup limiting maxclients do work...

Share This Page