-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make the __VU execution control var available in the init phase #889
Comments
Problems:
Both are fixable - the first one could be something like -1 (0 is actual valid value so I would prefer not to use it) , and the second can be fixed with some argument to archive that says "import this files as well" and leave it to the user to do the right thing. |
The second one is an issue even now, you can use |
Just wanted to add a note that implementing this after #1007 would be much better. That's because currently, when VUs are ramped down and then back up again, their import { sleep } from "k6";
export let options = {
stages: [
{ target: 10, duration: "5s" },
{ target: 0, duration: "5s" },
{ target: 10, duration: "5s" },
],
}
export default function () {
console.log(__VU)
sleep(3);
} The maximum number that will be printed with k6 v0.25.1 is somewhere around 19-20, even though we only ever have 10 VUs at max. With the code from #1007, it's going to always be 10. This is because |
The complicated handling of context in RunOnce is not necessary. Each of the new executors handles contexts and VUs very deliberately and precisely. We can separate the context handling to interrupt goja runtime and the actual running user's code. This PR introduces two new interfaces, "InitializedVU" annd "ActiveVU". InitializedVU is what Runner.NewVU will return, and is stored in ExecutionState.vus buffer. Whenever a InitializedVU is pull from the buffer, caller can call InitializedVU.Activate with VUActivationParams argument. This will return an ActiveVU, which will actually run the user's code. The InitializedVU.Activate will spawn a goroutine to track the context for interrupting script execution, and calling the callback function and return the VU to the buffer. Fixes #889 Fixes #1283
The complicated handling of context in RunOnce is not necessary. Each of the new executors handles contexts and VUs very deliberately and precisely. We can separate the context handling to interrupt goja runtime and the actual running user's code. This PR introduces two new interfaces, "InitializedVU" annd "ActiveVU". InitializedVU is what Runner.NewVU will return, and is stored in ExecutionState.vus buffer. Whenever a InitializedVU is pull from the buffer, caller can call InitializedVU.Activate with VUActivationParams argument. This will return an ActiveVU, which will actually run the user's code. The InitializedVU.Activate will spawn a goroutine to track the context for interrupting script execution, and calling the callback function and return the VU to the buffer. Fixes #889 Fixes #1283
The complicated handling of context in RunOnce is not necessary. Each of the new executors handles contexts and VUs very deliberately and precisely. We can separate the context handling to interrupt goja runtime and the actual running user's code. This PR introduces two new interfaces, "InitializedVU" annd "ActiveVU". InitializedVU is what Runner.NewVU will return, and is stored in ExecutionState.vus buffer. Whenever a InitializedVU is pull from the buffer, caller can call InitializedVU.Activate with VUActivationParams argument. This will return an ActiveVU, which will actually run the user's code. The InitializedVU.Activate will spawn a goroutine to track the context for interrupting script execution, and calling the callback function and return the VU to the buffer. Fixes #889 Fixes #1283
The complicated handling of context in RunOnce is not necessary. Each of the new executors handles contexts and VUs very deliberately and precisely. We can separate the context handling to interrupt goja runtime and the actual running user's code. This PR introduces two new interfaces, "InitializedVU" annd "ActiveVU". InitializedVU is what Runner.NewVU will return, and is stored in ExecutionState.vus buffer. Whenever a InitializedVU is pull from the buffer, caller can call InitializedVU.Activate with VUActivationParams argument. This will return an ActiveVU, which will actually run the user's code. The InitializedVU.Activate will spawn a goroutine to track the context for interrupting script execution, and calling the callback function and return the VU to the buffer. Fixes #889 Fixes #1283
The complicated handling of context in RunOnce is not necessary. Each of the new executors handles contexts and VUs very deliberately and precisely. We can separate the context handling to interrupt goja runtime and the actual running user's code. This PR introduces two new interfaces, "InitializedVU" annd "ActiveVU". InitializedVU is what Runner.NewVU will return, and is stored in ExecutionState.vus buffer. Whenever a InitializedVU is pull from the buffer, caller can call InitializedVU.Activate with VUActivationParams argument. This will return an ActiveVU, which will actually run the user's code. The InitializedVU.Activate will spawn a goroutine to track the context for interrupting script execution, and calling the callback function and return the VU to the buffer. Fixes #889 Fixes #1283
The complicated handling of context in RunOnce is not necessary. Each of the new executors handles contexts and VUs very deliberately and precisely. We can separate the context handling to interrupt goja runtime and the actual running user's code. This PR introduces two new interfaces, "InitializedVU" annd "ActiveVU". InitializedVU is what Runner.NewVU will return, and is stored in ExecutionState.vus buffer. Whenever a InitializedVU is pull from the buffer, caller can call InitializedVU.Activate with VUActivationParams argument. This will return an ActiveVU, which will actually run the user's code. The InitializedVU.Activate will spawn a goroutine to track the context for interrupting script execution, and calling the callback function and return the VU to the buffer. Fixes #889 Fixes #1283
The complicated handling of context in RunOnce is not necessary. Each of the new executors handles contexts and VUs very deliberately and precisely. We can separate the context handling to interrupt goja runtime and the actual running user's code. This PR introduces two new interfaces, "InitializedVU" annd "ActiveVU". InitializedVU is what Runner.NewVU will return, and is stored in ExecutionState.vus buffer. Whenever a InitializedVU is pull from the buffer, caller can call InitializedVU.Activate with VUActivationParams argument. This will return an ActiveVU, which will actually run the user's code. The InitializedVU.Activate will spawn a goroutine to track the context for interrupting script execution, and calling the callback function and return the VU to the buffer. Fixes #889 Fixes #1283
The complicated handling of context in RunOnce is not necessary. Each of the new executors handles contexts and VUs very deliberately and precisely. We can separate the context handling to interrupt goja runtime and the actual running user's code. This PR introduces two new interfaces, "InitializedVU" annd "ActiveVU". InitializedVU is what Runner.NewVU will return, and is stored in ExecutionState.vus buffer. Whenever a InitializedVU is pull from the buffer, caller can call InitializedVU.Activate with VUActivationParams argument. This will return an ActiveVU, which will actually run the user's code. The InitializedVU.Activate will spawn a goroutine to track the context for interrupting script execution, and calling the callback function and return the VU to the buffer. Fixes #889 Fixes #1283
The complicated handling of context in RunOnce is not necessary. Each of the new executors handles contexts and VUs very deliberately and precisely. We can separate the context handling to interrupt goja runtime and the actual running user's code. This PR introduces two new interfaces, "InitializedVU" annd "ActiveVU". InitializedVU is what Runner.NewVU will return, and is stored in ExecutionState.vus buffer. Whenever a InitializedVU is pull from the buffer, caller can call InitializedVU.Activate with VUActivationParams argument. This will return an ActiveVU, which will actually run the user's code. The InitializedVU.Activate will spawn a goroutine to track the context for interrupting script execution, and calling the callback function and return the VU to the buffer. Fixes #889 Fixes #1283
It could probably be useful for different things, chiefly something like this:
If we have split different static credentials in files named as
0.json
,1.json
, and2.json
, each VU will take up only a third of the memory it would have consumed if all of the data was in a single file.The
evaluation needed
tag is because it's unclear if there are obstacles for implementing this, or if it can have some negative consequences.The text was updated successfully, but these errors were encountered: