Updates & News 11 November 2020

k6 v0.29.0 released

Simon Aronsson, Developer Advocate

This release contains the work of over 10 contributors split over more than 100 commits. v0.29.0 contains a whole bunch of new, exciting features. We hope that you'll enjoy it as much as we do!

Read the full release notes here.

New features and enhancements

gRPC support

k6 now supports unary gRPC calls via the new k6/net/grpc built-in module. Streaming RPCs are not yet supported and the JS API is in beta, so there might be slight breaking changes to the API in future k6 versions, but it's a good start on the road to fully supporting this much-requested protocol!

You can find more information and examples how to use k6's new gRPC testing capabilities in our documentation. We'll also post a tutorial here in the coming days explaining gRPC, the support in k6 and how to use it to load test gRPC servers.

Huge thanks to @rogchap for adding this feature! ❤️

New options for configuring DNS resolution

With v0.29.0, we're extending the ability to control how the k6 DNS resolution works. Three new DNS resolution options are exposed in this k6 version: ttl, select, and policy. All configurable from the li using the --dns flag, using the K6_DNS environment variable, or within your test script using the dns option.

This also changes the defaults, making the ttl 5m, ip selection random and policy preferIPv4. Additional details are available in the docs.

Support for Go extensions

Say hello to the most recent addition to the k6 ecosystem, xk6! xk6, modeled after xcaddy, is a small stand-alone tool allowing users to build custom k6 binaries with 3rd party extensions bundled in.

Rather than relying on runtime interpretation, extensions bundled with xk6 will be fully compiled into the final custom k6 binary, making it a lot more performant.

Expect more information soon, but just to give you a little sneak peek, xk6 will work somewhat like this:

$ xk6 build v0.29.0 \
--with github.com/grafana/xk6-k8s \
--with github.com/grafana/xk6-sql@v0.1.1
$ ./k6 run some-script-with-sql-and-k8s.js

Thanks, @andremedeiros, for pushing us to add plugins in k6 and for making a valiant attempt to harness Go's poor plugin API! Thank you, @mardukbp, for pointing us towards the xcaddy approach and making us aware of its benefits!

Support for setting local IPs, potentially from multiple NICs

You can now specify a list of source IPs, IP ranges and CIDRs for k6 run, from which VUs will make requests via the new --local-ips CLI flag or K6_LOCAL_IPS environment variable. The IPs will sequentially be given out to VUs, allowing you to distribute load between different local addresses.

This feature, paired up with multiple network adapters, has the potential to greatly increase the available network throughput. For instance, if you have 2 NICs, you can run k6 with --local-ips="<IP-from-first-NIC>,<IP-from-second-NIC>" to balance the traffic equally between them.

Thanks to @ofauchon, @srguglielmo, and @divfor for working on previous iterations of this!

Other Improvements

  • It's now possible to block hostnames with the new blockHostnames option. Thanks, @krashanoff!
  • The gjson library k6 uses for handling the HTTP Response.json(selector) behavior was updated, so we now support more modifiers like @flatten and multipaths. Thanks, @sondnm!
  • The status text returned by the server while doing HTTP requests can now be accessed from the new Response.status_text field. Thanks, @lcd1232!
  • --http-debug now emits extra UUID values that can be used to match HTTP requests and their responses. Thanks, @repl-david-winiarski!
  • A new allowedLabels sub-option is added to the Loki configuration, allowing Loki to filter out unwanted labels.
  • For cloud users, aborting a k6 cloud test with Ctrl+C, k6 will now wait for the cloud service to fully abort the test run before returning. A second Ctrl+C will cause it to immediately exit. Thanks, @theerapatcha!
  • k6 will now attempt to recover from Go panics that occur in VU code, so they will be treated similarly to JS exceptions. This is just a precaution that should never be needed. Panics should not happen and if one occurs, please report it in our issue tracker, since it's most likely a bug in k6.
  • A bunch of other bugfixes and minor improvements you can see in the full release notes.

Breaking Changes

As mentioned above, DNS resolution defaults were changed. If you want to use the old k6 behavior of always picking the first IP, no IPv4 preference, and caching DNS responses indefinitely, run k6 with --dns="ttl=inf,select=first,policy=any".

As always, we appreciate the community feedback on our tool, k6. Please test it, and report any issues, either on GitHub or the community forum. We also welcome any contributions.

< Back to all posts