Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How does KeepAlive setting in Apache 2.4 help

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 7.13k
    Comment on it

    Keep-Alive is a Directive in Apache that is used to maintain a persistent connection between client and server, which prevents a connection from breaking. It is also known as HTTP keep-alive, When we put KeepAlive Directive "on" it the allows same TCP connection for HTTP communication instead of creating a new connection for every new request.


    1-We can enable Keep-Alive explicitly requesting via HTTP header.

    In case we are not able to access our server configuration file, we can add HTTP headers by using .htaccess file.The .htaccess file can be used as a configuration control file which will affect if placed in any directory of our choice where we want to work it.Write the following code :

    <IfModule mod_headers.c>
        Header set Connection keep-alive
    </IfModule>
    

    By adding this code in .htaccess file enable us to include Keep-Alive headers to our requests, which will override other settings.


    2- If we can access the apache configuration file (i.e. /etc/apache2/apache2.conf for Debian/Ubuntu), you can turn on keep-alive in this file.In a fresh Apache installation it is bydefault enabled.Keep-Alive can be set by editing few settings in Apache configuration file as below.

    2.1-Enabling and Disabling KeepAlive

        a- To enable  : KeepAlive On 
    b- To disable : KeepAlive Off  
    

    2.2-MaxKeepAliveRequests :

    It provides an option to set the max number of requests for every KeepAlive connection.A value 100 is good enough for almost any scenario in case of apache2.4. However, this value can be increased depending on the amount of files in a web page that the server will deliver.

    2.3-KeepAliveTimeout:

    It prevents unused connections to exist for too long. It sets a time, which specifies that after what time server can create new request from client.

    The number of seconds Apache httpd will wait for a subsequent request before closing the connection is ideal between 5 to 10 seconds in case of apache2.4. Postfixing ms the timeout can be set in milliseconds.


    For more information see the link below:

    http://httpd.apache.org/docs/2.4/mod/core.html

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: