Learn about load testing for websites, apps and APIs using k6, an open source load testing tool. k6 is available on GitHub. Run tests locally, behind the firewall, or in the cloud. Analyze results with Load Impact Insights.
2. LOAD IMPACT
Presenter:
Mark Meier
Client Success, Team Lead
With Load Impact since Summer 2015
Previously worked for SaaS companies in the
HR space and B2B consumer electronics
sales
Hobby Python developer, Runner, Hiker and
Homebrewer.
Enjoys performance testing more than any
human probably should
3. LOAD IMPACT
Agenda
● What is k6?
● How do I get k6?
● Overview of a k6 load test script
● Streaming a test into Load Impact Insights and overview of results
4. LOAD IMPACT
k6 Load Generator
● Modern load testing tool built for
developers & testers
● Built in Go, scripting in JavaScript
ES6
● Open Source
● > 3800 GitHub Stars
● Local & Cloud Execution
● Fits nicely into DevOps
workflows / automation
pipelines
5. LOAD IMPACT
Dev
Load Impact Insights
Automated analysis + Pass/Fail notifications + Performance Trending + Team/Project dashboards
Staging Production
$ k6 run script.js $ k6 cloud script.js
$ k6 cloud script.js
$ k6 cloud script.js
Local Execution Cloud Execution BETA
Shared & Exclusive IPs
CI
Code from individual devs Integration into end-to-end system + QA Deployment to production for business
Reuse scripts
VCS
Developer Team End-users
CI
VCS
ConfigExecution+Analysis
Load Testing Solution: k6 + Load Impact Insights + Cloud Execution
7. LOAD IMPACT
k6 scripting overview
1. Scripting done in JavaScript
2. Supports HTTP(s) and Websocket protocols
3. Script by hand or use k6’s built in HAR file converter
4. Journeys/test cases are expressed as code
5. You can do programmatic things
6. Scripts can be custom modules for common actions to share
8. LOAD IMPACT
k6 script
1. Import functionality
2. Set global options
a. Stages
b. Thresholds
c. Extending to LI
cloud
3. Create custom
metrics
9. LOAD IMPACT
k6 script
Main function
Where the bulk of
the test logic lives
1. Start of main
group/first
request
2. Checks (Asserts)
on that request
3. Record custom
metrics
4. Subgroup for
static assets
10. LOAD IMPACT
k6 script
Final page or “group”
Similar pattern
POST on line 91 - this can
be parameterized for
more realistic testing
This is testing a simple
website, your needs will
likely vary
11. LOAD IMPACT
k6 Local Execution and Load Impact Insights
k6 local execution
Load Impact Insights
$ k6 run -o cloud script.js