- Notifications
You must be signed in to change notification settings - Fork2
Load testing of the GraphHopper architecture.
License
graphhopper/graphhopper-load-test
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This tool will allow you to load test the GraphHopper API. It usesLocust torun a swarm of users on the infrastructure.The business logic of what endpoints to hit and with what parameters is saved inpersonas/.
If you have admin permissions tographhopper/load-testing, you can runmake push to build andpush the Docker image to Docker Hub.
Otherwise you can runmake build to build the Docker image without pushing it.
This application is mainly written in Python. If you don't want to deal with Python's packaging,you can use Docker. In this case prepend all the commands that you see below withdocker run graphhopper/load-testing. So if you see./run -h, you can usedocker run graphhopper/load-testing ./run -h to run the command.
If, on the other hand, you're familiar with Python and its packaging system, you can first set upyour environment as you see fit (e.g. using virtual environment). The only thing that is requiredis to install the packages inrequirements.txt, usually done withpip install -r requirements.txt.
To print the current version of the app, run:
./run --versionRun the following to see the help page on how to run this tool.
./run -h./run -p vrp -d 10s -u 10 <example.com>In its most basic form, all you need to do to start a load testing session, is to configure:
- Persona used with
-p. E.g. for VRP, usevrp. Check the help (./run -h) to see all theavailable personas. - Duration with
-d, e.g.300sfor 300 seconds or20mfor 20 minutes. - The number of users with
-u. In general, each user will run the associated task every second orso. Technically, the wait time israndom.expovariate(1),meaning an average of 1 second. Though VRP is more complex as it does an optimize and thensolutions. The ramp-up of users will be instantaneous as the ramp-up is set to the number ofusers. - The base URL. This is where the base of the service is deployed. A few examples:
- If you're testing the matrix service at
/matrixon HTTPS, then the base URL would behttps://example.com/. - If you're testing the VRP service at
/api/1/vrpon port 8080, then the base URL would behttp://example.com:8080/api/1.
- If you're testing the matrix service at
- [optional] set the API key using
--api-key [key]
There are currently three ways of running a load test. This is not ideal, the reasons are purelytechnical and it would be best to have just one, but here we are.
- Using
./run. This is mostly the best way. It is a wrapper around Locust. In this variation, itruns thelocustCLI command, setting the needed parameters and environment variables for us. - Using
./run --custom-output. This one uses the Python programmatic API to the Locust library,so it's the most extensible option. Currently we have our own custom output, for times when youdon't want to get all the output of intermediate results. - Using
locust(docker run graphhopper/load-testing locust). This is for times when you want touse some Locust functionality that is not yet included in./run. If this happens, we shouldprobably add support for the missing feature in the./runcommand.
If you want more information about failed requests, use the--debug switch and it will display theactual error for every error that happens in real time.
VRP has some additional configurations that we can use when running a load test. You can set thelikelyhood of using TomTom data with--vrp-tomtom-probability,set VRP profiles with--vrp-profiles, set the max VRP vehicle profiles with--vrp-max-profilesand set the max locations with--vrp-max-locations.
Read more about it on the./run -h help page.
Most of the times, running one instance of the load test is not enough. I can reliable use around300 users per running instance, it seems to not handle more. So in order to run with more users, weneed to run Locust in a master/worker configuration.
You run the master once and then the workers how many times you want, I go forusers/300. Forexample, if I want to do 1800 users, I will run 6 workers (6 * 300 = 1800).
# master./run --debug -p vrp -d 600s -u 600 --master --expect-workers=2 <example.com># worker./run --debug -p vrp --vrp-max-locations 5 --worker --master-host=<master-ip> <example.com>The<master-ip> can be127.0.0.1, if you're running other instances on the same machine, whichwe do a lot.
About
Load testing of the GraphHopper architecture.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.