Funkload ftw

Saturday 25 October 2008

We are getting ready to roll out a new service at work, and are particularly concerned about the traffic levels it could receive, so we embarked on a quick-and-dirty load test.

I took a quick look at the open source tools available, and most are only capable of hammering on a URL, or on a list of URLs. Because our application is dynamic, with newly-created unique IDs being passed from URL to URL, we needed more expressive power than a data file of URLs could give us.

Then I found funkload. As the name (sort of) suggests, it can do both functional and load testing, and that is where its power lies. The functional testing focus means that you write your tests as Python unit tests, with the full power of Python and webunit to build the test case. Funkload can run the tests like functional tests (run each once and see if they succeed), or like load tests (run just one, but over and over).

I wrote a test case that runs through the entire experience end-to-end, about a dozen URLs, screen-scraping the returned HTML where I needed to extract dynamic data for use in the next URL. Funkload then ran the test on many thread at a measured rate, producing a report on tests per second, successes and failures, and so on. Looking at the funkload's numbers and the server stats during the test, we could determine the traffic load our servers are capable of.

Funkload isn't the fanciest load tester out there, and if you only need to hammer on a home page, it's more than you need, but for load testing dynamic applications, it's just right.


Corey 3:44 PM on 25 Oct 2008

JMeter and OpenSTA are good free/open source tools that work very well for generating more advanced load tests at the HTTP layer. Both are pretty robust and capable of parsing, scraping dynamic data, cookies, data files, etc.. You can model custom workloads and generate nice results for analysis.

Ned Batchelder 5:09 PM on 25 Oct 2008

I looked a bit at JMeter, and though it seemed very capable, it was also a whole new tool to master. OpenSTA looks similar. Though both have tools to write powerful tests, those tools seem to be custom, and therefore unfamiliar and probably limited in some way. Funkload gives me good old Python to use, so it was very quick for me to get going with.

Grig Gheorghiu 7:41 PM on 27 Oct 2008

Ned -- care to go into some more detail showing a simple example of funkload in action? The last time I looked at it, a couple of years ago, it wasn't super easy to set up and configure, but maybe that changed. I've been meaning to look into it myself lately.


Ned Batchelder 8:07 PM on 27 Oct 2008

I wanted to put in a sample, but my test is actually kind of involved what with adapting the webunit responses to the Django responses I'm used to, and the details of the screen scraping. Maybe I'll get to it...

Add a comment:

Ignore this:
not displayed and no spam.
Leave this empty:
not searched.
Name and either email or www are required.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.