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

handling large vu shifts #3470

Merged
merged 17 commits into from
Feb 28, 2024

Conversation

VincentSchmid
Copy link
Contributor

@VincentSchmid VincentSchmid commented Nov 25, 2023

What?

It validates the VU values. If a VU is larger than the chosen constant, an error is appended.
This includes the startVU.

Why?

The conclusion was reached to handle it that way during the discussions of this pull request.

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

Closes #1693

@CLAassistant
Copy link

CLAassistant commented Nov 25, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot requested review from codebien and oleiade November 25, 2023 16:10
@oleiade oleiade self-requested a review November 27, 2023 10:16
lib/executor/ramping_vus_test.go Outdated Show resolved Hide resolved
lib/executor/ramping_vus.go Outdated Show resolved Hide resolved
lib/executor/ramping_vus_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@codebien codebien left a comment

Choose a reason for hiding this comment

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

Hey @VincentSchmid,
thanks for your contribution 🎉

The current approach is working but I would prefer if we use a different one. We should have a validating function instead of one returning the sum. In this way, we can directly return an error from the function. It would be similar to the validateStages function that already exists.

Also, note, that the same logic has to be applied to the ramping arrival rate executor.

@VincentSchmid VincentSchmid requested a review from a team as a code owner January 5, 2024 23:05
@VincentSchmid VincentSchmid force-pushed the fix/handling-large-vu-numbers branch 2 times, most recently from d9b0df4 to 74d797e Compare January 5, 2024 23:19
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2024

Codecov Report

Attention: 75 lines in your changes are missing coverage. Please review.

Comparison is base (77bb9ae) 72.55% compared to head (2a101b0) 73.48%.
Report is 55 commits behind head on master.

❗ Current head 2a101b0 differs from pull request most recent head d243881. Consider uploading reports for the commit d243881 to get more accurate results

Files Patch % Lines
cmd/builtin_output_gen.go 16.66% 19 Missing and 1 partial ⚠️
cmd/report.go 63.41% 15 Missing ⚠️
execution/scheduler.go 57.57% 7 Missing and 7 partials ⚠️
js/modules/resolution.go 0.00% 5 Missing ⚠️
cmd/outputs.go 75.00% 2 Missing and 1 partial ⚠️
execution/controller.go 75.00% 1 Missing and 1 partial ⚠️
js/jsmodules.go 88.88% 2 Missing ⚠️
js/modules/k6/http/request.go 66.66% 1 Missing and 1 partial ⚠️
js/modules/k6/http/response.go 0.00% 2 Missing ⚠️
lib/archive.go 60.00% 0 Missing and 2 partials ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3470      +/-   ##
==========================================
+ Coverage   72.55%   73.48%   +0.93%     
==========================================
  Files         276      275       -1     
  Lines       20840    20206     -634     
==========================================
- Hits        15120    14848     -272     
+ Misses       4758     4405     -353     
+ Partials      962      953       -9     
Flag Coverage Δ
ubuntu 73.48% <71.48%> (+0.98%) ⬆️
windows ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@VincentSchmid VincentSchmid force-pushed the fix/handling-large-vu-numbers branch from 74d797e to 7d8be76 Compare January 8, 2024 09:54
lib/executor/helpers.go Outdated Show resolved Hide resolved
lib/executor/helpers.go Outdated Show resolved Hide resolved
lib/executor/ramping_vus_test.go Outdated Show resolved Hide resolved
lib/executor/helpers.go Outdated Show resolved Hide resolved
lib/executor/ramping_vus_test.go Outdated Show resolved Hide resolved
lib/executor/ramping_vus_test.go Outdated Show resolved Hide resolved
lib/executor/ramping_vus_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@codebien codebien left a comment

Choose a reason for hiding this comment

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

Now, checking this again it doesn't sound like the logic for the validation based on the sum is required.

I may miss some obvious reason, but can you clarify why is it not enough to just validate the maxTarget returned by this code?

lib/executor/helpers.go Outdated Show resolved Hide resolved
lib/executor/helpers.go Outdated Show resolved Hide resolved
lib/executor/ramping_vus_test.go Outdated Show resolved Hide resolved
Copy link
Member

@oleiade oleiade left a comment

Choose a reason for hiding this comment

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

Great job @VincentSchmid 👏🏻 🙇🏻

The current implementation matches my initial assumptions and expectations. I've left a bunch of comments more on the minor side that I think should still be addressed before we merge this, but besides that, it starts looking good 🎉

I couldn't help but notice that although we use the mechanism in the context of the ramping arrival rate executor, we haven't added tests for it (which might have led to the issue of naming somehow?). I would prefer to see tests for that usage too 🙇🏻

lib/executor/helpers.go Outdated Show resolved Hide resolved
lib/executor/ramping_arrival_rate.go Outdated Show resolved Hide resolved
lib/executor/helpers.go Outdated Show resolved Hide resolved
Copy link
Member

@oleiade oleiade left a comment

Choose a reason for hiding this comment

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

Great job @VincentSchmid 👏🏻 🙇🏻

The current implementation matches my initial assumptions and expectations. I've left a bunch of comments more on the minor side that I think should still be addressed before we merge this, but besides that, it starts looking good 🎉

I couldn't help but notice that although we use the mechanism in the context of the ramping arrival rate executor, we haven't added tests for it (which might have led to the issue of naming somehow?). I would prefer to see tests for that usage too 🙇🏻

@oleiade
Copy link
Member

oleiade commented Jan 29, 2024

As I'm at it, in case that proves useful to any of you folks, here's the script I used to try the feature locally:

import http from 'k6/http';

export const options = {
	scenarios: {
		vus: {
			executor: 'ramping-vus',
			startVUs: 0,
			stages: [
				{duration: '20s', target: 10},
				{duration: '10s', target: 100000100},
			],
		},
		rate: {
			executor: 'ramping-arrival-rate',
			startRate: 0,
			preAllocatedVUs: 50,
			stages: [
				{duration: '20s', target: 10},
				{duration: '10s', target: 100000100},
			]
		}
	}
}

export default function () {
	http.get('http://test.k6.io')
}

Which made me think that it could also be worth adding end 2 end tests demonstrating the behavior?

lib/executor/helpers.go Outdated Show resolved Hide resolved
lib/executor/helpers.go Outdated Show resolved Hide resolved
lib/executor/helpers.go Outdated Show resolved Hide resolved
lib/executor/helpers.go Outdated Show resolved Hide resolved
lib/executor/ramping_vus_test.go Outdated Show resolved Hide resolved
lib/executor/helpers.go Outdated Show resolved Hide resolved
lib/executor/ramping_arrival_rate.go Outdated Show resolved Hide resolved
@VincentSchmid
Copy link
Contributor Author

Thank you guys for your patience, I had fun doing this with you and I learned some things!

@codebien codebien merged commit b217bbf into grafana:master Feb 28, 2024
24 checks passed
@codebien
Copy link
Contributor

Hey @VincentSchmid, thank you so much for your effort here. 🎉

mstoykov added a commit that referenced this pull request May 29, 2024
During #3470 some sub tests were added and they access the same variable
from the not sub test.

This obviously is a race condition that nobody noticed.
mstoykov added a commit that referenced this pull request May 29, 2024
During #3470 some sub tests were added and they access the same variable
from the not sub test.

This obviously is a race condition that nobody noticed.
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.

Huge VU numbers in ramping-vus result in a panic
5 participants