Weighttpd, Windows and PowerShell

Recently I’ve been using a great benchmarking took called Weighttpd, from the makers of the Lighttpd Web Server. Weighttpd is great because it is multithreaded, unlike it’s ancient and still used predecessor, Apache Benchmark (ab). I have made a short PowerShell script that uses this tool in Windows in order to run benchmarks that step through concurrency levels.

I’ve been using this on Linux with no problems in combination with this script from G-WAN developer, Pierre.

Now the script is excellent, and does have Windows support however I’ve been having problems compiling C on my Windows test server, most likely due to failure on my own part.

What I like about the script he has kindly provided is that it allows you to run benchmarks at intervals in an automated fashion, thereby saving time and effort. Rather than running hundreds of tests manually at different concurrency levels, the code above will do the lot for you.

I really wanted to test the script out on Windows so I could compare IIS against some other web servers (apples to oranges, I know) so I made this PowerShell hack which runs the weighttpd.exe file in a similar way. Similar in that I can run a test with 1,000,000 requests to the web server and have it step through them increasing the level of concurrency every X amount of steps.

This is my first PowerShell attempt, so please excuse the mess – test.ps1

$i = 1
$j = 10
$x = 10
do {
  .\WeigHTTP.exe -n 100000 -c $j -t 4 -k localhost/100.html
  $i; $i++; $j = $x + $j;
}
while ($i -le 100)

This will basically run weighttpd.exe on 4 threads, with the concurrency being the variable $j which increases by 10 every loop. The loop in this instance will run 100 times, allowing for concurrency levels 10 through to 1000 in this test.

You can then specifically print out the lines displaying the requests per second running something such as:

.\test.ps1 | where {$_ -match "req/s"}

If this file is test2.ps1, then in PowerShell I would run “.\test2.ps1 > outfile.txt” in order to save that.

I was then thinking of having PowerShell tidy up the output a bit, but I don’t have any problems doing that in Linux instead as I’m much more familiar with that.

Obviously this is no where near as efficient or feature rich as the original C script, but it gave me the idea of being able to do this in Windows with PowerShell.

  1. Performance difference between IIS 7.5 and IIS 8 | Root Users - pingback on August 27, 2012 at 7:07 pm

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Trackbacks and Pingbacks: