Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove --num-requests/-n in favor of --run-time/-t #656

Merged
merged 5 commits into from
Sep 19, 2017
Merged

Conversation

heyman
Copy link
Member

@heyman heyman commented Sep 18, 2017

This adds the --run-time/-t option that can be used, together with --no-web, to specify the run time of a test. It also removes the -n/--num-requests option as discussed in #196 and #512 (which can both be closed once this is merged).

timespan_regex = re.compile(r'((?P<hours>\d+?)h)?((?P<minutes>\d+?)m)?((?P<seconds>\d+?)s)?')
parts = timespan_regex.match(time_str)
if not parts:
raise ValueError("Invalid time span format")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit: it'd be nice if this message showed the valid or expected formats from the docstring

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@aldenpeterson-wf
Copy link
Contributor

This should probably be added to the docs too, but this looks great and something we will definitely want to use 👍

Moved info on how to run Locust without the web UI, and how to retrieve CSV stats, into their own documentation pages. 
Added info about --time-limit option.
Added info about --expect-slaves option.
@heyman
Copy link
Member Author

heyman commented Sep 19, 2017

Thanks! I've now added info to the documentation (very good point :)).

I actually ended up restructuring the docs a bit, by moving out info on how to run Locust without the web UI, as well as how to retrieve CSV stats, into their own pages. It didn't really belong on the Quickstart page, and now it'll be easier to find directly from the docs index page.

I'll go ahead and merge this.

@heyman heyman merged commit cbd71e1 into master Sep 19, 2017
This was referenced Sep 19, 2017
@cgoldberg cgoldberg added this to the 0.9.0 milestone Apr 24, 2018

if options.run_time:
if not options.no_web:
logger.error("The --run-time argument can only be used together with --no-web")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does it forbid this option if we are working from the web console ?

In my use-case I would find it super useful to be able to start the test from the web, and have it stopping automatically even when I am disconnected / in a meeting after some time or when I hit the stop button. This would avoid me forgetting to stop the test and act as security to avoid a test running for ever...

Am I the only one who would like this feature not restricted to the --no-web ? Should I create an issue / feature request ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would want this feature to be used with the web interface too, would be very useful.

@rk4n3
Copy link

rk4n3 commented Aug 23, 2019

Why was the -n/--num-requests removed ? Both mechanisms have distinct value/usage-scenarios, and I am one that really needs the -n/--num-requests capability.

In short, a particular test (with plenty of sophistication in its design/operation) is needed for both typical load testing scenario, AND a separate scenario where a single execution must execute and exit as quickly as possible.

Can we restore the lost functionality ?

@PraveenWhatfix
Copy link

PraveenWhatfix commented Aug 23, 2019

Why was the -n/--num-requests removed ? Both mechanisms have distinct value/usage-scenarios, and I am one that really needs the -n/--num-requests capability.

In short, a particular test (with plenty of sophistication in its design/operation) is needed for both typical load testing scenario, AND a separate scenario where a single execution must execute and exit as quickly as possible.

Can we restore the lost functionality ?

Yes, this would be a good feature to have. If we want to test performance for a particular number of requests rather than run-time.

@heyman
Copy link
Member Author

heyman commented Oct 17, 2019

Why was the -n/--num-requests removed ? Both mechanisms have distinct value/usage-scenarios, and I am one that really needs the -n/--num-requests capability.

One problem with having the --num-requests option is how it's supposed to work when running Locust distributed. Either we would make the master runner send out a stop message to all the worker nodes when the number of requests have been reached. However this method would result in a situation where more requests than the specified would be fired. This could be confusing for someone who assumes that the specified --num-requests would be respected. Alternatively the master node could - at start time - direct each node to only perform a certain number of requests, but that could cause some workers to stop generating load earlier than others, resulting in a RPS drop at the end of the test.

@albertleadata
Copy link

Why was the -n/--num-requests removed ? Both mechanisms have distinct value/usage-scenarios, and I am one that really needs the -n/--num-requests capability.

One problem with having the --num-requests option is how it's supposed to work when running Locust distributed.

It would be perfectly reasonable (and to me acceptable) if this were addressed by making the -n/--num-requests option supported for non-distributed operation only. It could even be asserted that it only makes sense in smaller-scale testing scenarios, which would naturally fall outside distributed operation anyway.

In my case, the need for it is specific to very small-scale tests that have to be executed at high iteration - the tests need to execute and completely exit as fast as possible, with only a specific and small number (often only 1) requests made.

@heyman
Copy link
Member Author

heyman commented Oct 18, 2019

It would be perfectly reasonable (and to me acceptable) if this were addressed by making the -n/--num-requests option supported for non-distributed operation only. It could even be asserted that it only makes sense in smaller-scale testing scenarios, which would naturally fall outside distributed operation anyway.

In my case, the need for it is specific to very small-scale tests that have to be executed at high iteration - the tests need to execute and completely exit as fast as possible, with only a specific and small number (often only 1) requests made.

I think everything that works non-distributed should work when running Locust distributed as well. We could possibly accept slightly different behaviour (e.g. the exact number of requests aren't guaranteed), but I'm not keen on having totally different feature sets.

Could you describe your use-case in more detail? To me, it doesn't really sound like it's a load test that you're doing.

@albertleadata
Copy link

Could you describe your use-case in more detail? To me, it doesn't really sound like it's a load test that you're doing.

Its not a load test - its what would be called a "synthetic health-check" ... its a test of arbitrary complexity that can benefit from (even require) all the functionality present in a load-testing tool like JMeter or Locust, but run to completion as quickly as possible with one iteration and 1 user.

@mbeacom mbeacom deleted the run-time-limit branch October 18, 2019 20:48
@vignesh-18
Copy link

Is there any way to stop the execution after specific number of requests are done?

@TimorMuzi
Copy link

Is there any way to stop the execution after specific number of requests are done?

Can you exit by throwing an StopLocus exception?
Or,You can try to judge in the code, when the number is reached, execute runners.locust_ runner.quit ()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.