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

concurrency as users per second #25

Closed
ghost opened this issue May 27, 2016 · 6 comments · Fixed by #78
Closed

concurrency as users per second #25

ghost opened this issue May 27, 2016 · 6 comments · Fixed by #78
Milestone

Comments

@ghost
Copy link

ghost commented May 27, 2016

Do you think it would be an idea to specify concurrency as users per second as Gatling does?

@mhjort
Copy link
Owner

mhjort commented Jun 17, 2016

I didn't know that Gatling has a such feature. But yeah it should not be that hard to implement. Definitely something to be added to clj-gatling.

So in options you could either use :concurrency or then :requests-per-second

However, I am not sure when I have time to implement this. PRs are always welcome ;)

@holyjak
Copy link

holyjak commented Oct 7, 2018

I could implement this perhaps. @mhjort could you be so kind and point me where in code to look / start? Thank you!

@viesti
Copy link

viesti commented Oct 23, 2018

Just dropping a friendly ping, I'd like this feature too :)

@mhjort
Copy link
Owner

mhjort commented Oct 23, 2018

Thanks for pinging. I had a quick look on this. Noticed it requires some thinking and totally forgot to answer :(

Since this feature was proposed clj-gatling has got quite a lot of other new features. So they should be adapted too. One of those features is :concurrency-distribution. So if new :request-per-second option is used there should be a similar :requests-per-second-distribution option.

The core functionality for running the simulation is in simulation.clj. That is a good place to start. It contains a full test suite in simulation_test.clj.

The way simulation works now is following:

  • clj-gatling starts as many go loops as is the required concurrency
  • go loop is inside a function called run-scenario-constantly
  • In every loop round request is started if concurrency is less than target concurrency

So the way to implement requests per second could be following:

  • Start go loops based on what is the maximum requests per second
  • Somehow keep track how many requests per second we are running at the moment
  • In every loop round start a request if we are running less than targeted requests per second

I have not tested that idea so this probably needs some testing. However, this could be a one way where to start. Are you still interested @jakubholynet ? It would be great if you could work with this.

@viesti
Copy link

viesti commented Oct 23, 2018

There's also this nice little library for throttling: https://github.com/brunoV/throttler. Might not be of direct use but the token bucket idea for rate limiting could be useful.

@holyjak
Copy link

holyjak commented Oct 28, 2018

Thank you! I run out of time but perhaps somebody else will take the ball :-) If not, then I will the next time I have an opportunity.

@mhjort mhjort added this to the Future milestone Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants