Load Impact offers a SaaS solution for k6 results storage, analysis and trending. It is called Load Impact Insights. Insights allows you to run your load tests locally using k6 while streaming your results to loadimpact.com where you can look at the test in real time and also perform detailed results analysis.
As part of its SaaS solution, Load Impact also offers distributed execution from the cloud, to run larger and/or geographically distributed tests.
This means you can run your own load generator and test internal systems, but benefit from a more powerful and convenient SaaS solution when you want to store, share and analyze test results. You can utilize the loadimpact.com cloud to execute tests (but such tests will require that the target system is reachable from the public Internet).
First you need to create a loadimpact.com account
Once logged in, click the "CLI" link in the left menu (at the bottom).
- Follow the instructions on screen to get k6 installed and setup for steaming test results.
If you have already installed k6 you only need to make sure you have it configured with access to your Load Impact API token. You do that by either running k6 login cloud
and entering your Load Impact account details or you set the K6_CLOUD_TOKEN
to your API token value (you can also use the API token to login from the command-line using k6 login cloud -t <YOUR_API_TOKEN>
).
Don't forget to add -o cloud
to specify that you want the test results streamed to Insights!
K6_CLOUD_TOKEN=c3b391149764640ed7d51476cd34a947f0d0762552a5bae79ee10b07ee84c1f7 k6 run -o cloud script.js
docker run -i -e "K6_CLOUD_TOKEN=c3b391149764640ed7d51476cd34a947f0d0762552a5bae79ee10b07ee84c1f7" loadimpact/k6 run -o cloud - <script.js
Now your test should be running, and results should be streamed live to loadimpact.com. k6 will output something like this when it starts:
As you can see in the screen shot above, k6 will tell you that you can use the URL https://app.loadimpact.com/k6/runs/179
to go directly to the test result/analysis page where results will be updated continuously throughout the test.
By default tests and test runs will be created and run under your default project, in your default organization. To create and run tests under a different project, whether under your default organization or one you've been invited to, you have two options:
1.
You can specify the project ID in the script options:
export let options = {
ext: {
loadimpact: {
projectID: 123456
}
}
}
2.
You can set the K6_CLOUD_PROJECT_ID
environment variable when running the test.
You find the ID of a Load Impact project by selecting a k6 project in the UI and looking in the URL bar of your browser, the 12345
in https://app.loadimpact.com/projects/12345/dashboard
is the project ID.
When you run a k6 test run against Load Impact Insights, data will be continuously streamed to the cloud. While this happens the test's run state will be marked as Running
. A test run that ran its course will be marked Finished
. The run state has nothing to do with the test passing any of its checks, only that the test itself is operating correctly.
If you deliberately abort your test (e.g. by pressing Ctrl-C), it will still be considered Finished
by Insights. You can still look and analyze the test data you streamed so far. The test will just have run shorter than originally planned.
Another possibility would be if you lose network connection with Load Impact Insights while your test is running. In that case Insights will patiently wait for you to reconnect. In the meanwhile your test's run state will continue to appear as Running
on the Insights web overview. If no reconnection happens, Insights will time out after two minutes of no data, setting the run state to Timed out
. You can still analyze a timed out test but you'll of course only have access to as much data as was streamed before the network issue.
Since version 0.21.0, k6 supports partial aggregation of metrics streamed to Load Impact Insights for reduced bandwidth usage and processing times. To enable this, set the environment variable K6_CLOUD_AGGREGATION_PERIOD
to the aggregation period you want, for example 1s
. If there are more than a certain number of HTTP metrics for a period (100 by default, but it can be modified by setting K6_CLOUD_AGGREGATION_MIN_SAMPLES
), they are partially aggregated. It is important to note that outlier metrics are automatically detected and sent separately, they are never aggregated.
Load Impact also offers a commercial cloud service for distributed execution of k6 tests. See the Cloud execution page for more information.
Detailed information about Insights analysis/results view
Updated 2 months ago