How to improve your Apache Web server’s performance?

apache logo1
Social sharing

Apache

The performance of web application depends upon the performance of the webserver and the database server.

You can increase your web server’s performance either by adding additional hardware resources such as RAM, faster CPU, etc. or you can get better performance on the same hardware through Cloud Management, by doing some custom configuration to the webserver.

Contents

Here are some custom configurations for better performances

  • Load only the required modules:

Apache server is a modular program which includes the functionality of selecting a set of modules. So it’s suggested to run Apache with only the required modules which will reduce the memory footprint and hence the server performance.

  • Choose appropriate MPM:

Apache comes with a number of Multi-Processing Modules (MPMs) which binds the network ports to the machine. But only one MPM can be loaded at a time, so choose the appropriate MPM for your application. It depends on various factors like, whether the OS supports threads, available memory, scalability versus stability, whether non-thread-safe third-party modules are used, etc.

  • DNS lookup:

Keep “HostnameLookups off” to reduce latency to every request since the DNS lookup has to be completed before the request is finished.

  • AllowOverride:

Make “AllowOverride all” to reduce additional file system lookups.

  • FollowSymLinks:

Add the option ‘FollowSymLinks’ to make the server follow the symbolic links in the directory.

  • Content Negotiation:

Option ‘Multiviews’ scans the directory for files, which causes latency.

  • MaxClients:

‘MaxClients’ is the limit on maximum simultaneous requests. It should be set to low so that new connections are put in queue.

  • MinSpareServers, MaxSpareServers, and StartServers:

The ‘MinSpareServers’ and ‘MaxSpareServers’ determines how many child processes should be kept waiting for request. Now you can adjust it as your requirement.

Listed below are some tweaks to help you around

StartServers—2

MinSpareServers—2

MaxSpareServers—5

ServerLimit—100

MaxClients—100

MaxRequestsPerChild—4000

  • KeepAlive and KeepAliveTimeout:

The ‘KeepAlive’ directive allows multiple requests to be sent over the same TCP connection. This is useful when HTML pages use a lot of images.

KeepAlive–on

Timeout–20

  • HTTP Compression & Caching:

Use mod_deflate module for HTTP Compression. Most of the browsers are supporting it.

  • Separate server for static and dynamic content:

For dynamic contents Apache server needs 3M to 20M of RAM, while for the static contents it consumes only 1M. To reduce latency use separate servers for static and dynamic contents.

  • Reducing network load:

Use ‘mod_gzip’ to compress the data in order to reduce bandwidth. Most of the browsers are supporting it.

Your recently viewed posts:

Jayadev Das - Post Author

Do what you do best in – that’s what I’ve always believed in and that’s what I preach. Over the past 25+ years (yup that’s my expertise ‘n’ experience in the Information Technology domain), I’ve been consulting to small, medium and large companies ‘About Web Technologies, Mobile Future as well as on the good-and-bad of tech. Blogger, International Business Advisor, Web Technology Expert, Sales Guru, Startup Mentor, Insurance Sales Portal Expert & a Tennis Player. And top of all – a complete family man!

    Contact Us

    We’d love to help & work with you




    When do you want to start ?


    Enter your email address to stay up to date with the latest news.
    Holler Box

    Orange Exit pop up

    Subscribe for the latest
    trends in web and
    mobile app development
    Holler Box

    Exit pop up

    Sad to see you leaving early...

    From "Aha" to "Oh shit" we are sharing everything on our journey.
    Enter your email address to stay up to date with the latest news.
    Holler Box