Are You Ready for High Volume Traffic?

/ / Apache /
  • 3.3 out of 5 Stars
Please note: this article is over 15 years old. Information may be out of date.

Many webmasters wish they got a lot of traffic to their site. A day may come and their website may be very popular in just one day. This could be a reason that unique article is published on their site, or just a simple change in search position results in major search engines. So you get a lot of traffic, but is your server ready for this? Pages may take seconds to load and many visitors may think that the site is not available right now and go somewhere else.

Web Server

Today we will talk about Linux and apache tips and tricks that will help webmaster to tune their dedicated server to handle high traffic.

How to see that you get a lot of traffic? Check log files, or check traffic rating at alexa.

How to see that your server is not capable of handling it? Use uptime command or top command. load average: 0.31, 0.46, 0.33 line is to search for. The first number shows current load (1 min average), second and third number show 5 and 15 min load average. If your 5-15 server load average is higher than 10 you have to worry about items discussed below.

Dissect your rivals' key traffic drivers

Apache configuration

httpd.conf is a file file, usually located at /usr/local/apache/conf/httpd.conf path containing configuration settings for apache server. Cannot find the location of the file? Use locate command: >cd / then >locate httpd.conf

Main parameters to tune are:

  • MaxClients - sets the limit on the number of simultaneous requests that can be supported. Never set this number to high. Setting MaxClients parameter to a big number will lead to consumption of all available memory on your server and a hard disk swapping may occur. In other words the server will try to use hard disk space as additional memory, which is a very-very slow process. How to detect this? Use top command. Typical output of a swap command is shown below. Swap “41852k used” and Mem “624148k used” are two lines to look at. It memory size is approaching to total and swap used is growing then you are in trouble. Check MaxClients parameter. How to find what is the maximum that I can set? Calculate the average of your httpd process, divide total available memory by the average leaving some for the system. E.g. in case of 1 Gig RAM and average httpd process size 7MB on this server it is safe to set it to 100. What to set it to a larger value? Add more physical RAM.
    top - 01:04:08 up 4 days, 2:19, 1 user, load average: 0.31, 0.46, 0.33
    Tasks: 129 total, 1 running, 128 sleeping, 0 stopped, 0 zombie
    Cpu(s): 5.0% us, 1.3% sy, 0.3% ni, 87.4% id, 5.6% wa, 0.3% hi, 0.0% si
    Mem: 1027668k total, 624148k used, 403520k free, 10300k buffers
    Swap: 2048276k total, 41852k used, 2006424k free, 446804k cached
    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    15856 nobody 15 0 47532 7180 3532 S 3.3 0.7 0:00.17 httpd
    16097 nobody 15 0 46736 6036 3212 S 1.3 0.6 0:00.06 httpd
  • KeepAlive - allows multiple requests to be sent over the same TCP/IP connection. Turning it on can greatly improve the speed of your server, particularly when you have static pages and are serving quite a bit of images from your server. An example would be a catalogue site with screenshots. From my experience it is best to keep it On
  • KeepAliveTimeout – sets the number of seconds that the child httpd process sits and takes memory. From my experience it is best to set it to minimum, 1-3 seconds.
  • MaxRequestsPerChild – sets how many requests to serve per new httpd child process. You may set it very low, thus constantly freeing the memory, however on a particular case values like 15 or 20 may work well.

After you change settings in httpd.conf do not forget to restart apache. You may do this from control panel or from command line

> service httpd restart
Dissect your rivals' key traffic drivers

Rate This Article

How would you rate the quality of this content?
Currently rated: 3.3 out of 5 stars. 11 users have rated this article. Select your rating:
  • 3.3 out of 5 Stars
  • 1
  • 2
  • 3
  • 4
  • 5

Related Articles

Web Server

How to Use Mod_rewrite For URL Rewriting in Apache

URL Rewriting is the process of manipulating an URL or a link, which is send to a web server in such a way that the link is dynamically modified at the server to include additional parameters and information along with a server initiated redirection.
Restricted Area

How to Restrict Access to a Directory Using Password Authentication

This article explains how to restrict access to directories with Basic HTTP Authentication. Basic HTTP Authentication (or Basic Access Authentication) is a simple security mechanism to restrict access to websites or some parts of them by requiring an username and password, which is managed by a visitor's web browser when making a request.
Web Server

Mod_Rewrite For Newbies

This article is not a complete guide to Apache's mod_rewrite neither to .htaccess. Its purpose is to help you - the webmaster - to create "mod_rewritten" versions of your dynamic webpages even if you have limited technical knowledge.
Web Server

Apache htaccess for PHP web application deployment

The following is a brief introduction to Apache's htaccess file for web application deployment, distribution, or implementation on shared hosting environments. The Apache htaccess file is not new; however it seems to only be used by more advanced Apache users and web application developers.
Web Server

6 Tips To Secure Your Website

Most people on the internet are good, honest people. However, there are some people browsing the internet who derive fun from poking around websites and finding security holes. A few simple tips can help you secure your website in the basic ways.
Intel Xeon E3 1230 V3 servers from $49/month