This is a k6 extension using the xk6 system.
❗ This is a proof of concept, isn't supported by the k6 team, and may break in the future. USE AT YOUR OWN RISK! |
---|
This projects implements a singular local counter(name is bad) that goes up. It will return the current value before increasing it, and each VU will get a different value. Which means that it can be used to iterate over an array, where:
- only one element will be used by each VU
- the array doesn't need to be sharded between the VUs it will "dynamically" balance between them even if some elements take longer to process
This totally doesn't work in distributed manner, so if there are multiple k6 instances you will need a separate service (API endpoint) which to do it. |
---|
Predominantly because of the above this is very unlikely to ever get in k6 in it's current form, so please don't open issues :D.
To build a k6
binary with this extension, first ensure you have the prerequisites:
Then, install xk6 and build your custom k6 binary with the Kafka extension:
- Install
xk6
:
$ go install go.k6.io/xk6/cmd/xk6@latest
- Build the binary:
$ xk6 build --with github.com/mstoykov/xk6-counter@latest
import counter from "k6/x/counter"
export default function() {
console.log(counter.up(), __VU, __ITER)
}