How to prevent memory exhaustion while using Apache Keep Alive?

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

  1. postcd

    postcd Member

    Messages:
    65
    Likes Received:
    5
    Trophy Points:
    8
    Hello,

    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 New Member

    Messages:
    25
    Likes Received:
    16
    Trophy Points:
    3
    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

    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    nice suggestions.... yup limiting maxclients do work...

Share This Page