Fixing the empty response graphs in Pylot load testing

response_time_graphAs part of managing this website, I recently started running some basic load tests to see how many simultaneous users it takes to bog the site down. Being a Python guy, I was delighted to find a simple tool called Pylot, that allows me to run simple scenarios and see graphs of the results, without having to take a 3-week course learning how to use the much more powerful JMeter.

The only problem I had getting results from Pylot was that it has not been updated in some time, and the toolkit it uses to generate the graphs has changed since those days, making the graphs it now produces appear empty. Fortunately, the fix was trivial, but for those not versed in the mystical arts of Python, I thought I’d post the steps. It really is quick.

In the unpacked pylot directory, you’ll find a folder called core, and within that, there is a file called graph.py. Load that file in your favorite code editor and find the lines that look like this:

axis(xmin=0)
x_seq = [item[0] for item in nested_resp_list]

Change those lines to look like this:

#axis(xmin=0)
xmin = nested_resp_list[0][0]
x_seq = [item[0]-xmin for item in nested_resp_list]

(Specifically, add the ‘#’ to the first line, insert the second line, and then change the last line to add the “-xmin” after “item[0]”.)

Similarly, in the next function down, you’ll find the bit that looks like this:

axis(xmin=0)
keys = throughput_dict.keys()

And again comment out the “axis(xmin=0)” statement by putting a “#” in front of it, making it look like this:

#axis(xmin=0)
keys = throughput_dict.keys()

That’s it. Save the file and close the editor. Now when you run the load tester and look at your result graphs, the response time graph should be full of blue squiggles (like the one at the top of this article) and the throughput graph should be full of red ones. Happy load testing.

About the author

Jefferson Smith is a Canadian fantasy author, as well as the founder, chief editor and resident proctologist of ImmerseOrDie. With a PhD in Computer Science and Creativity Systems compounded by a life spent exploring most art forms for fun and profit, he is underqualified in just about everything. That's why he writes.