question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

locust does not respond when the time to complete a single request is (very) long

See original GitHub issue

Describe the bug

When running locust against a database with queries that needs long processing time (above 3 seconds) locust does not respond anymore:

Expected behavior

Locust should work as usual

Actual behavior

  • run as local: stopping the test from the UI does not work. The runner keeps sending request to the database
  • run as master/worker the master loose the worker, printing heartbeat not arrived.

Steps to reproduce

I have created a repository. It need docker and Unix tools, python packages: locust and pyscopg2.

  1. git clone https://github.com/belloni-SAP/locust_sql
  2. cd locust_sql
  3. run ./prepare_test.sh
  4. Al local:
    • locust -f postgres_test.py start test from UI and try to stop. In the terminal locust keeps sending request to the database.
    • distributed * master: locust -f postgres_test.py --master * worker: locust -f postgres_test.py --worker After few seconds in the master terminal an heartbeat problem will try to stop the test. Increasing the value of the heartbeat-related variables in locust.runnerhave no effect.

Environment

  • OS: Linux - x86_64 GNU/Linux
  • Python version: Python 3.7.1
  • Locust version: locust 1.2.3
  • Locust command line that you ran: see above
  • Locust file contents (anonymized if necessary): see above

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
belloni-SAPcommented, Oct 9, 2020

Many thanks. After using the correct driver, everything works fine. We are, however, using also another driver which is not gevent-friendly.

I was thinking if it could be useful for others to insert in https://docs.locust.io/en/stable/testing-other-systems.html a hint to this possible problematic.

0reactions
cyberwcommented, Oct 14, 2020

Cool!

For postgres, there are standard environment variables that are automatically used (PGHOST, PGPORT, etc https://www.postgresql.org/docs/current/libpq-envars.html), which is neat (and I use that approach for TimescaleListener in locust-plugins).

As long as you provide the ability to override them in code (using class-level variables on the User maybe?), especially if you want to use TimescaleListener AND your User 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Locust : How to make locust run for a specific amount of time
This answer is out of date. Locust now has a -t / --run-time parameter for specifying run time.
Read more >
Increase performance with a faster HTTP client
As long as your load generator CPU is not overloaded, FastHttpUser's response times should be almost identical to those of HttpUser. It is...
Read more >
Quick Tutorial on Locust
The UI will show real-time statistics on how the server responds to the requests ... Now that you are familiar with what Locust...
Read more >
Locust - Read the Docs
Note: Running Locust on Windows should work fine for developing and testing your load testing scripts. However, when running large scale ...
Read more >
Performance and Load Testing using Locust - PFLB
There is no better place for a QA solution than PFLB. Drop us a line to find out what our team can do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found