| #!/bin/sh |
| # - runtime |
| # - iterations |
| # - nr_threads |
| |
| ## Siege is an http load testing and benchmarking utility. It was |
| ## designed to let web developers measure their code under duress, |
| ## to see how it will stand up to load on the internet. |
| |
| apache_dir="/etc/apache2" |
| iter_time=$(( runtime / iterations )) |
| |
| ## Below HTML and siegerc from Mel Gorman's MMTests |
| cat > /var/www/html/siege.html <<EOF |
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <head> |
| <title>siege dummy tester</title> |
| </head> |
| <body> |
| <h1>siege dummy tester</h1> |
| |
| This is a basic HTML page with no useful information and serves as a static |
| web page for testing siege. Obviously more complex tests of the software |
| stack would require pages that exercise the system of interest. |
| |
| Here is a text to bring the page size up to 1K. |
| Here is a text to bring the page size up to 1K. |
| Here is a text to bring the page size up to 1K. |
| Here is a bunch of text to bring the page size up to 1K. |
| Here is a bunch of text to bring the page size up to 1K. |
| Here is a bunch of text to bring the page size up to 1K. |
| Here is a bunch of text to bring the page size up to 1K. |
| Here is a bunch of text to bring the page size up to 1K. |
| Here is a bunch of text to bring the page size up to 1K. |
| <img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"> |
| </p> |
| </body> |
| </html> |
| EOF |
| |
| [ -e $apache_dir/mods-enabled/authz_core.load ] || ln -s $apache_dir/mods-available/authz_core.load $apache_dir/mods-enabled/ |
| [ -e $apache_dir/mods-enabled/mpm_event.load ] || ln -s $apache_dir/mods-available/mpm_event.load $apache_dir/mods-enabled/ |
| |
| apachectl -k restart 2>&1 |
| |
| [ $HOME ] || export HOME=/root |
| cat > $HOME/.siegerc << EOF |
| verbose = false |
| quiet = true |
| gmethod = HEAD |
| show-logfile = true |
| logging = false |
| protocol = HTTP/1.1 |
| chunked = true |
| cache = false |
| connection = close |
| concurrent = 500 |
| file = /etc/siege/urls.txt |
| delay = 1 |
| timeout = 40 |
| failures = 10 |
| internet = false |
| benchmark = false |
| user-agent = LKP |
| accept-encoding = gzip |
| url-escaping = true |
| spinner = true |
| unique = true |
| EOF |
| |
| for ITER in `seq 1 $iterations`; do |
| log_cmd siege -b -t ${iter_time}s \ |
| -c $nr_threads \ |
| http://localhost/siege.html 2>&1 |
| done |