
Benchmarking your LAMP server
ab
is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving.
Apache-utils package contains utility programs for webservers and some add-on programs useful for any webserver. These include:
- ab (Apache benchmark tool)
- Logresolve (Resolve IP addresses to hostname in logfiles)
- htpasswd (Manipulate basic authentication files)
- htdigest (Manipulate digest authentication files)
- dbmmanage (Manipulate basic authentication files in DBM format, using perl)
- htdbm (Manipulate basic authentication files in DBM format, using APR)
- rotatelogs (Periodically stop writing to a logfile and open a new one)
- split-logfile (Split a single log including multiple vhosts)
- checkgid (Checks whether the caller can setgid to the specified group)
- check_forensic (Extract mod_log_forensic output from apache log files)
This package Apache-Utils can be install through apt or YaST depending if you are using a Debian base distro or OpenSuse
Prerequistes
- Define realistic objectives, do not create too much virtual clients if you do not have usually that kind of user traffic..
- For example an objective could be: number of users served, or percentage of the requests served within a certain time
- This tool ab do not simulate realistic user behavior, it just hit a page without being able to simulate a complex workflow (like login, navigate and do things users usually do)
- Try to monitor at the same time the CPU/Memory consumed in order not to make false assumption on apache settings (use top d 1)
Attention
It is an iterative process!
- Benchmark,
- Change settings and
- Restart benchmark.
It is very important to only change a setting a time in order to better identify what is really bringing something! By changing only one settings at a time, you can:
- Better see the influence on CPU, memory (you must look also at resources, a server swapping to disk is never good)
- There is not so much universal settings bringing a speed kick (except DNSlookup off, keep alive small), some settings are depending on your Linux kernel version, CPU class, disk speed, network latency
Other components
While tuning apache, you will see that most of the time is used in PHP/MySQL, for MySQL recommend to run at the same time tuning-primer.sh, read more here