Djangocon: Using Python to load-test web apps - Yulia Zozulya

Tags: django, djangocon

(One of the summaries of a talk at the 2015 Djangocon EU conference).

Using python for your load testing is handy. You use the same language that you use for development. You can more easily write small functions to help you.

FunkLoad is often used. You configure it with a text file. You can fire off requests from separate tests. You can configure the various treads to have a startup delay and delays between individual requests.

Handy: Funkload classes are inherited from unittest.TestCase. They are easy to understand and write. You can use them as smoke tests with simple unittest runners. You can even distribute the benchmark over multiple machines in a testing environment. It is also very well documented and extensible.

Funkload also has drawbacks. It uses python’s default threading module, which means you’re probably not using all your machine’s power. The tool itself is configurable, but the default reports are not. And they’re not very nice.

Multi-mechanize is an alternative. It uses multiprocessing along with threading, so you really use your machine’s power. The default reports are more configurable.

It also has drawbacks. The API is not as obvious as Funkload’s. And distributed workflow isn’t supported.

A third option is locust.io. It uses greenlets, those are very fast. And there is a lightweight web UI for real-time monitoring. Really convenient. Distributed workflow is possible. All the configuration is done in python code.

A drawback is that it uses tricky terminology.

You could take a look at whether you want to use python (2) at all. The GIL gives you performance problems. It is a bit strange to test performance with a tool that itself might have performance problems.

Photo from our 2014 cycling holiday
 
vanrees.org logo

Reinout van Rees

My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):