Updates & News 01 April 2021

Announcing the Public Beta of our Next Generation Runtime

Simon Aronsson, Developer Advocate

At k6, we pride ourselves in always putting the need of developers and testers first. Throughout the years, we've tried many different solutions to make the experience of authoring load tests as pleasant and value-creating as possible.

In the since-sunsetted LoadImpact v3, we allowed users to author tests in the lua scripting language, which, to us, was a big improvement to the earlier generation of tools, which either only allowed GUI-based test authoring, declarative configuration in XML files or writing your tests in C.

In 2017, we announced k6, a brand new next-gen load testing tool which in our opinion lowered the bar of entry even further by sporting a new, fast, JavaScript runtime backed by ever-so-performant go code.

Today, we're thrilled to announce our next exciting step, further pushing the limits of how intuitive and easy-to-use test authoring can be. As of this message, all users are invited to try out our brand-new runtime!

Runtime Logo

A couple of years ago one of our founders, Ragnar Lönn, did a nifty no-frills proof of concept called curl-basher.

Our new runtime builds upon the promising findings of that PoC, taking it one step further and giving you, the user, access to the whole powerhouse that is bash.

Getting started

So, let's have a look at how this will work in practice. During the beta-phase, you'll have to compile the k6 binary yourself using xk6:

$ go install go.k6.io/xk6/cmd/xk6@latest && \
xk6 build v0.31.1 \
--with github.com/dgzlopes/xk6-exec

That will produce a k6 binary in your current folder:

$ ls -la
total 59256
drwxr-xr-x 4 simme staff 128 31 Mar 15:14 .
drwxr-xr-x 14 simme staff 448 31 Mar 14:59 ..
-rwxr-xr-x 1 simme staff 30331992 31 Mar 15:14 k6
-rw-r--r-- 1 simme staff 548 31 Mar 15:11 test.js

Once it reaches General Availability, this will become the default mode for writing k6 scripts, but for now we'll have to import the bash support function exec from k6/x/exec:

Example Script
1import exec from 'k6/x/exec';
3export default function () {
4 console.log(
5 exec.command('bash', [
6 '-c',
7 `
8 export URL=https://httpbin.test.k6.io/anything/foo=bar
9 export CONCURRENCY=10
10 export ITERATIONS=2
12 for (( j = 1; j <= $CONCURRENCY; j++ ))
13 do
14 (
15 for (( i = 1; i <= $ITERATIONS; i++ ))
16 do
17 curl $URL 2>/dev/null -o /dev/null
18 if [ $? != 0 ]; then
19 echo -n "-"
20 else
21 echo -n "+"
22 fi
23 done
24 )
25 done
27 echo "\t Done!"
28 `,
29 ])
30 );

As you can tell from that snippet, it's really easy and intuitive to use. It's also blazingly fast! Let's run it and have a look at the output:

/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: test.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
INFO[0009] ++++++++++++++++++++ Done! source=console
running (00m09.2s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m09.2s/10m0s 1/1 iters, 1 per VU
data_received........: 0 B 0 B/s
data_sent............: 0 B 0 B/s
iteration_duration...: avg=9.2s min=9.2s med=9.2s max=9.2s p(90)=9.2s p(95)=9.2s
iterations...........: 1 0.108644/s
vus..................: 1 min=1 max=1
vus_max..............: 1 min=1 max=1

Only 8 seconds for 20 requests? Wow, that's fast! You can also see that we in our script added support for pass/fail visualisation using +'s to signal success, and - to signal fail.

Plans for the future

You tell us! We are planning to add support for other popular runtimes as well, like perl, x86-assembler and BASIC.

Imagine being able to author your tests with direct memory access! The future truly is now!


😂 Happy April's fools!

If you've gotten this far, we probably don't need to tell you this, but: Happy April's fools!

While the examples above indeed do work thanks to the xk6 extension system, we're staying comitted to building the k6 tool with the best developer experience and ergonomics in mind. Right now, this means sticking to the JavaScript runtime while making the tool even more solid and versatile.

Did you enjoy the article? Did we trick you? Please let us know in the comments below.

Much love,
the k6 Team

< Back to all posts