I recently used Locust, a load testing tool that lets you write intuitive looking Python code to load test your web applications. I did not follow Locust’s install guide and instead just tried a ‘pip install locustio’. I ended up running into some issues that were not easy to Google about. So I thought I would document the problems I faced along with there solution over here.
Getting setup with Locust on Windows
If you have not already tried installing Locust, follow this short and handy guide. It will help you avoid the problems I faced.
1. Use Python 2.7.x where x >=4. I upgraded my Python to 2.7.11.
pip install pyzmq
pip install locustio
4. Test your installation by opening up a command prompt and typing
locust.--help You should see no errors or warning – only the usage and help should be printed out on your console.
Locust install issues and solutions
When I installed Locust for the first time, I missed steps 1 and 2 in the section above. So I ran into a couple of errors.
1. ImportError: DLL load failed
from gevent.hub import get_hub, iwait, wait, PYPY
File “c:\python27\lib\site-packages\gevent\hub.py”, line 11, in
from greenlet import greenlet, getcurrent, GreenletExit
ImportError: DLL load failed: The specified procedure could not be found.
I got this error because I had Python 2.7.2 (python –version) and Locust needs at least Python 2.7.4. To solve this issue, upgrade your Python version. I ended up installing Python 2.7.11.
2. UserWarning: WARNING: Using pure Python socket RPC implementation instead of zmq
c:\python27\lib\site-packages\locust\rpc__init__.py:6: UserWarning: WARNING: Using pure Python socket RPC implementation instead of zmq.
I got this warning when running the command ‘locust –help’ to test my setup. The warning comes with a helpful recommendation to install pyzmq. I installed pyzmq (
pip install pyzmq) and the error went away.
3. pip install locustio gives error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
I got the below error when install locust using pip install locustio
building ‘gevent.corecext’ extension
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
I tried installing “gevent” alone using pip install gevent, but got the same error
After bit of searching i installed “gevent” from unofficial windows Binaries for Python Extension Packages.
Download the whl file as per your os combination. I downloaded gevent-1.1.1-cp27-cp27m-win32.whl file.
open command prompt in the directory where you have downloaded whl file and run the below command.
python -m pip install gevent-1.1.1-cp27-cp27m-win32.whl
After that i was able to install locust successfully.
My thoughts on Locust as of May, 2016
A random collection of my thoughts having explored Locust for a little bit.
1. This tool is worth exploring deeper. This is the first load testing tool that I found intuitive.
2. Locust lets me reuse the API checks that I anyway write as part of testing a web application
3. I liked Locust’s documentation. I found the documentation very, ummm, Pythonic! Clearly they have put in effort into making the documentation useful.
4. I got a useful, working prototype for a real world problem in less than a weekend
5. I don’t know how powerful their http client (the one you use to make requests) is … so we may trip up at login for some clients.
6. I hated the way they do not have an automatic ‘end’ to any test – but that is a minor complaint
7. With respect to the resources (memory, CPU) on the client machine, locust swarms scale so much better than Qxf2’s map-reduce solution (think 25:1)
8. There is a limit of 1024 locusts per swarm that maps to the maximum number of files that can be open on Windows. But their documentation warns you about this beforehand. You can increase this number, if needed, on your OS.
9. Their reporting is not persistent or stored
Qxf2 will be exploring this tool over the coming months. I want to try more complex login scenarios, nested tasks and distributed swarms.