Basic and super-experimental support for distributed execution #3205
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This PR adds very basic and very experimental support for distributed execution, including packaging and sending the script to agents, and
setup()
andteardown()
handling. It is another sliver of the newly refactored #2816 and built on top of #3191 and #3204.This is done via the new
k6 agent
andk6 coordinator
sub-commands and in a completely backwards-compatible manner. They have been marked asHidden
because the feature is definitely not ready for any kind of serious use and is very experimental. It currently doesn't have any tests or a lot of the required error handling...This PR also doesn't add support distributed metric handling (i.e. centralized thresholds or the end-of-test summary). That part of the original proof-of-concept PR was refactored and moved in a separate commit and can be added as a separate pull request later, to make reviewing and potentially merging each PR easier 🎉
Another big missing element in this PR is any sort of mutual authentication and authorization of the gRPC connection between
k6 agent
andk6 coordinator
. Given that the communication between these components could potentially happen over the internet, that feature is a must before the feature could be considered anywhere near ready for general use.Finally, the
--instance-count
CLI flag ofk6 coordinator
is probably somewhat basic and insufficient for a lot of complex use cases. A more flexible configuration should probably should probably also be supported. For example,k6 coordinator
can rely on the--execution-segment-sequence
option to know the number of desired instances and their respective segments. If we add some new option to allow users to specify instance tags (e.g.key=value
metadata pair everyk6 agent
instance is started with),k6 coordinator
will be able to match individual instances to individual segments.And now, after I've described all of the shortcomings and missing features of this PR above, it's a reasonable question to ask why it should be merged without them:
Why?
In short, because all of the missing features of this PR (including end-to-end tests) can be added later! Even though this is far from a polished and ready-to-use implementation of distributed execution, it is completely backwards compatible and makes no breaking k6 changes! Notice how no existing k6 tests have been disabled or even changed in any way! 🎉
I'd argue that it will be easier to actually get all of these things done in small increments once this PR is merged in
master
🤞 And even if nothing from the missing things is prioritized, it will still be better to have this merged, to reduce the required upkeep of these PoCs (i.e. reduce merge conflicts when rebasing) over time. Having this inmaster
also helps to avoid logical conflicts of other big features and refactorigns with it (e.g. #3112 had some issues).Finally, even in its current super-basic form, this might actually be useful to some people for some use cases. For example, grafana/k6-operator#223 might be better implemented on top of this feature instead of from scratch 🤔
Checklist
make ci-like-lint
) and all checks pass.make tests
) and all tests pass.Related PR(s)/Issue(s)
setup
/teardown
k6-operator#223