Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Load testing of the GraphHopper architecture.

License

NotificationsYou must be signed in to change notification settings

graphhopper/graphhopper-load-test

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/.

Build

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.

Run

Docker or no Docker?

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.

Get current version

To print the current version of the app, run:

./run --version

Get help

Run the following to see the help page on how to run this tool.

./run -h

Basic usage

./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.300s for 300 seconds or20m for 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/matrix on HTTPS, then the base URL would behttps://example.com/.
    • If you're testing the VRP service at/api/1/vrp on port 8080, then the base URL would behttp://example.com:8080/api/1.
  • [optional] set the API key using--api-key [key]

Three ways of running

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 thelocust CLI 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.
  • Usinglocust (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./run command.

Debugging errors

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.

Configuring VRP

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.

Running in master/worker mode

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp