Differences
This shows you the differences between two versions of the page.
— |
apache:stress-testing-with-apache-benchmark [2014-12-05 21:39:39] (current) rory.blanchard created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== How to Stress Test an Apache Server using AB (Apache Benchmark) ====== | ||
+ | Using a benchmarking tool to test the limits of your apache server will help you prepare for upgrades. | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | ===== Installing AB on CentOS (with cPanel) ===== | ||
+ | |||
+ | cPanel adds in an exclusion for all packages named httpd* (any files starting with httpd) to prevent accidentally overwriting apache. | ||
+ | |||
+ | **SSH** into your server. | ||
+ | |||
+ | Edit **/ | ||
+ | |||
+ | < | ||
+ | vi / | ||
+ | |||
+ | exclude=bind-chroot courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* mysql* nsd* php* proftpd* pure-ftpd* spamassassin* squirrelmail* | ||
+ | </ | ||
+ | |||
+ | Once the entry has been removed, **save** the config file and exit. | ||
+ | |||
+ | Run the following command to install ab. | ||
+ | |||
+ | < | ||
+ | yum install httpd-tools | ||
+ | </ | ||
+ | |||
+ | Make sure to go back into the **/ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | ===== Installing AB on Debian/ | ||
+ | |||
+ | **SSH** into your server (or if you are using a desktop open a **terminal**) | ||
+ | |||
+ | Run the following command to install ab. | ||
+ | |||
+ | < | ||
+ | sudo apt-get install apache2-utils | ||
+ | </ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | ===== Running a stress test ===== | ||
+ | |||
+ | Once you have the program installed, you can run a stress test against a domain name. | ||
+ | |||
+ | **WARNING: Do not use this against a site you do not control as it will be considered an attack.** | ||
+ | |||
+ | Here is an example of a stress test that will simulate 100 users simultaneously making accessing a website. | ||
+ | |||
+ | < | ||
+ | ab -c 100 -n 100 -r http:// | ||
+ | </ | ||
+ | |||
+ | You can check the manual for ab to find out more information about it's options. | ||
+ | |||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ |