SlideShare a Scribd company logo
Introduction to
Performance & Load
With k6
Leandro Melendez
Performance Advocate, k6
Who am I?
❑Leandro AKA Señor Performo
❑DevRel Perf @k6_io
❑Blog (www.srperf.com)
❑Host of PerfBytes
❑Youtube
❑Book Author
Performance
and load
testing?
“Performance testing:
validate and verify
how fast and efficient
is the SW under
different scenarios”
Performance
Testing
Load testing Synthetics
RUM SRE
Single thread Much more…
“Load testing is the
process of putting
demand on a system
and measuring its
response”
Answers from performance testing
Load Reliability Observability
In which
conditions my
system reaches its
limits and breaks?
How does my
system’s
performance
evolve over the
time?
Can my system
handle the
target load?
Performance
How fast and
efficient
is my
system?
Modern teams shifting performance testing left & right
Testing frequency
Release frequency
What to test
How is performance testing
initiated
When to test
Who is responsible for
performance testing
OLD WAY
Quarterly or biannually
QA
Load tests through user stories
Manually
Before releases
After all Dev and QA, right before release
NEW WAY
Weekly
Developers, QA/SDET, SRE
Continuously: at code check-in,
nightly/weekly, when infra changes, before
releases
Multiple scenarios through user stories,
services, infrastructure
Automatically and continuously as part of
CI/CD
Continuously through the SDLC and in prod
What are the incentives Misaligned between functions Aligned incentives of SLOs & Error budgets
k6.io
What is k6?
1
2
3
4
An Open Source load testing tool
Programmable
Simple, yet powerful
Extensible and easy to use
“Although it's easy to get started with k6 all on its
own, it really shines with its ease of integration
into a developer ecosystem.” Thoughtworks
Extensible? Wha dat?
Output Testing Misc
ChaiJS
xk6-mock
xk6-cache
xk6-cognito
etc
xk6-disruptor
xk6-crypto
xk6-docker
xk6-ethereum
etc
xk6-prometheus
xk6-datadog
xk6-es
xk6-file
etc
Protocols
xk6-Browser
xk6-sql
xk6-tcp
xk6-smtp
etc
Perf
concepts
Automated Measure
Manual
Ways to perf test
Many Several
1 user
What to perf test
Protocol Back End
Front End
Automation types
Protocol Back End
Front End
Automation types
VU Iterations Metrics
Options
More concepts
Simulating user
flows and workload
modeling, adding
think time
Setting SLOs for the
system under load
Using dynamically
generated or
random values
Scenarios Thresholds Test data
More concepts
Intermission
Let’s get
k6!
brew install k6
winget install k6
Scripting
A simple script
A more
realistic
example
Hands
on!
$ k6 run [script.js]
Run k6
But wait, there’s more! Options
k6 run --[Option] [optionValue] [script.js]
k6 run --[Option1] [optionValue] [script.js]
$ k6 run [script.js]
Test, VUs, scenarios, instances, etc
Run k6
But wait, there’s more! Options
k6 run --[Option] [optionValue] [script.js]
k6 run --[Option1] [optionValue] [script.js]
$ k6 run [script.js]
Test, VUs, scenarios, instances, etc
$ k6 run --vus 10 --duration 30s script.js
Run k6
Counters - sum values
Gauges - track the smallest, largest, and latest values
Rates - track how frequently a non-zero value occurs
Trends - calculate statistics for multiple values
Metrics
Output
k6.io/docs/using-k6/metrics/
Trend
k6.io/docs/using-k6/metrics/
Trend
Rate
k6.io/docs/using-k6/metrics/
Counter
Trend
Rate
k6.io/docs/using-k6/metrics/
Counter
Trend
Rate
Gauges
k6.io/docs/using-k6/metrics/
import http from 'k6/http';
import { Trend } from 'k6/metrics';
const myTrend = new Trend('waiting_time');
export default function () {
const r = http.get('https://httpbin.test.k6.io');
myTrend.add(r.timings.waiting);
console.log(myTrend.name); // waiting_time
}
Custom Metrics!
Output
Metrics and results output
Local LG
CSV & JSON
External
services
Prometheus
Grafana Cloud
k6 Cloud
Amzn CW
InfluxDb
DataDog
New Relic
etc
Visualizations
Team
$ k6 run 
--out json=test.json 
--out influxdb=http://localhost:8086/k6
$ k6 run --out json=test_results.gz script.js
Send results elsewhere
Output
Checks - validate boolean conditions in
your test.
Checks & Thresholds
Thresholds - pass/fail criteria that you
define for your test metrics
import { check } from 'k6';
import http from 'k6/http';
export default function () {
const res = http.get('http://test.k6.io/');
check(res, {
'is status 200': (r) => r.status === 200,
});
}
Check HTTP response
Check
import { check } from 'k6';
import http from 'k6/http';
export default function () {
const res = http.get('http://test.k6.io/');
check(res, {
'verify homepage text': (r) =>
r.body.includes('Collection of simple'),
});
}
Check for text in response body
Check
export const options = {
thresholds: {
metric_name1: ['threshold_expression', `...`], // short format
metric_name2: [
{
threshold: 'threshold_expression',
abortOnFail: true, // boolean
delayAbortEval: '10s', // string
},
], // full format
},
};
Syntax
Threshold
import http from 'k6/http';
export const options = {
thresholds: {
http_req_failed: ['rate<0.01'], // http errors should be less than 1%
},
};
export default function () {
http.get('https://test-api.k6.io/public/crocodiles/1/');
}
HTTP errors
Threshold
import http from 'k6/http';
export const options = {
thresholds: {
http_req_failed: ['rate<0.01'], // http errors should be less than 1%
http_req_duration: ['p(95)<200'], // 95% of requests should be below 200ms
},
};
export default function () {
http.get('https://test-api.k6.io/public/crocodiles/1/');
}
HTTP errors and response duration
Threshold
Much more!
● k6:
k6.io / github.com/grafana/k6
● Documentation k6:
k6.io/docs
● k6-Learn initiative:
github/grafana/k6-learn
● k6 in youtube:
youtube.com/@k6io
● k6 awesome & examples:
github/grafana/k6-learn
github/grafana/k6/samples k6.io/slack grafana/k6 community.k6.io
k6 Resources
Workshop: Introduction to Performance and Load Testing with k6

More Related Content

Similar to Workshop: Introduction to Performance and Load Testing with k6

Qc dept open_sta overview
Qc dept open_sta overviewQc dept open_sta overview
Qc dept open_sta overview
qc-pyramid
 
Load-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.ioLoad-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.io
Hassy Veldstra
 
Automating Speed: A Proven Approach to Preventing Performance Regressions in ...
Automating Speed: A Proven Approach to Preventing Performance Regressions in ...Automating Speed: A Proven Approach to Preventing Performance Regressions in ...
Automating Speed: A Proven Approach to Preventing Performance Regressions in ...
HostedbyConfluent
 
Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)
CIVEL Benoit
 
Cerberus_Presentation1
Cerberus_Presentation1Cerberus_Presentation1
Cerberus_Presentation1
CIVEL Benoit
 
Performance testing jmeter
Performance testing jmeterPerformance testing jmeter
Performance testing jmeter
Bhojan Rajan
 
B2 2005 introduction_load_testing_blackboard_primer_draft
B2 2005 introduction_load_testing_blackboard_primer_draftB2 2005 introduction_load_testing_blackboard_primer_draft
B2 2005 introduction_load_testing_blackboard_primer_draft
Steve Feldman
 
Jmeter From Scratch
Jmeter From ScratchJmeter From Scratch
Jmeter From Scratch
ChinmayBrahma22
 
Load Testing: See a Bigger Picture
Load Testing: See a Bigger PictureLoad Testing: See a Bigger Picture
Load Testing: See a Bigger Picture
Alexander Podelko
 
Eric Proegler Early Performance Testing from CAST2014
Eric Proegler Early Performance Testing from CAST2014Eric Proegler Early Performance Testing from CAST2014
Eric Proegler Early Performance Testing from CAST2014
Eric Proegler
 
Performance testing and j meter
Performance testing and j meterPerformance testing and j meter
Performance testing and j meter
Purna Chandar
 
Load Testing with k6 framework
Load Testing with k6 frameworkLoad Testing with k6 framework
Load Testing with k6 framework
Svetlin Nakov
 
load-testing-with-k6-nakov-at-qa-challenge-accepted-oct-2021-211002181104.pdf
load-testing-with-k6-nakov-at-qa-challenge-accepted-oct-2021-211002181104.pdfload-testing-with-k6-nakov-at-qa-challenge-accepted-oct-2021-211002181104.pdf
load-testing-with-k6-nakov-at-qa-challenge-accepted-oct-2021-211002181104.pdf
obuleshuppara
 
Webservice performance testing with SoapUI
Webservice performance testing with SoapUIWebservice performance testing with SoapUI
Webservice performance testing with SoapUI
Phuoc Nguyen
 
Performance testing using jmeter
Performance testing using jmeterPerformance testing using jmeter
Performance testing using jmeter
Rachappa Bandi
 
Getting Started with Apache Jmeter
Getting Started with Apache JmeterGetting Started with Apache Jmeter
Getting Started with Apache Jmeter
Mindfire Solutions
 
Testing - How Vital and How Easy to use
Testing - How Vital and How Easy to useTesting - How Vital and How Easy to use
Testing - How Vital and How Easy to use
Uma Ghotikar
 
Wap tpresentation (Load testing Tool )
Wap tpresentation (Load testing Tool )Wap tpresentation (Load testing Tool )
Wap tpresentation (Load testing Tool )
jagdishdevabhaipatel
 
Tools of the Trade: Load Testing - Ignite session at WebPerfDays NY 14
Tools of the Trade: Load Testing -  Ignite session at WebPerfDays NY 14Tools of the Trade: Load Testing -  Ignite session at WebPerfDays NY 14
Tools of the Trade: Load Testing - Ignite session at WebPerfDays NY 14
Alexander Podelko
 
Performance testing in agile
Performance testing in agilePerformance testing in agile
Performance testing in agile
OdessaQA
 

Similar to Workshop: Introduction to Performance and Load Testing with k6 (20)

Qc dept open_sta overview
Qc dept open_sta overviewQc dept open_sta overview
Qc dept open_sta overview
 
Load-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.ioLoad-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.io
 
Automating Speed: A Proven Approach to Preventing Performance Regressions in ...
Automating Speed: A Proven Approach to Preventing Performance Regressions in ...Automating Speed: A Proven Approach to Preventing Performance Regressions in ...
Automating Speed: A Proven Approach to Preventing Performance Regressions in ...
 
Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)
 
Cerberus_Presentation1
Cerberus_Presentation1Cerberus_Presentation1
Cerberus_Presentation1
 
Performance testing jmeter
Performance testing jmeterPerformance testing jmeter
Performance testing jmeter
 
B2 2005 introduction_load_testing_blackboard_primer_draft
B2 2005 introduction_load_testing_blackboard_primer_draftB2 2005 introduction_load_testing_blackboard_primer_draft
B2 2005 introduction_load_testing_blackboard_primer_draft
 
Jmeter From Scratch
Jmeter From ScratchJmeter From Scratch
Jmeter From Scratch
 
Load Testing: See a Bigger Picture
Load Testing: See a Bigger PictureLoad Testing: See a Bigger Picture
Load Testing: See a Bigger Picture
 
Eric Proegler Early Performance Testing from CAST2014
Eric Proegler Early Performance Testing from CAST2014Eric Proegler Early Performance Testing from CAST2014
Eric Proegler Early Performance Testing from CAST2014
 
Performance testing and j meter
Performance testing and j meterPerformance testing and j meter
Performance testing and j meter
 
Load Testing with k6 framework
Load Testing with k6 frameworkLoad Testing with k6 framework
Load Testing with k6 framework
 
load-testing-with-k6-nakov-at-qa-challenge-accepted-oct-2021-211002181104.pdf
load-testing-with-k6-nakov-at-qa-challenge-accepted-oct-2021-211002181104.pdfload-testing-with-k6-nakov-at-qa-challenge-accepted-oct-2021-211002181104.pdf
load-testing-with-k6-nakov-at-qa-challenge-accepted-oct-2021-211002181104.pdf
 
Webservice performance testing with SoapUI
Webservice performance testing with SoapUIWebservice performance testing with SoapUI
Webservice performance testing with SoapUI
 
Performance testing using jmeter
Performance testing using jmeterPerformance testing using jmeter
Performance testing using jmeter
 
Getting Started with Apache Jmeter
Getting Started with Apache JmeterGetting Started with Apache Jmeter
Getting Started with Apache Jmeter
 
Testing - How Vital and How Easy to use
Testing - How Vital and How Easy to useTesting - How Vital and How Easy to use
Testing - How Vital and How Easy to use
 
Wap tpresentation (Load testing Tool )
Wap tpresentation (Load testing Tool )Wap tpresentation (Load testing Tool )
Wap tpresentation (Load testing Tool )
 
Tools of the Trade: Load Testing - Ignite session at WebPerfDays NY 14
Tools of the Trade: Load Testing -  Ignite session at WebPerfDays NY 14Tools of the Trade: Load Testing -  Ignite session at WebPerfDays NY 14
Tools of the Trade: Load Testing - Ignite session at WebPerfDays NY 14
 
Performance testing in agile
Performance testing in agilePerformance testing in agile
Performance testing in agile
 

More from Applitools

Building the Ideal CI-CD Pipeline_ Achieving Visual Perfection
Building the Ideal CI-CD Pipeline_ Achieving Visual PerfectionBuilding the Ideal CI-CD Pipeline_ Achieving Visual Perfection
Building the Ideal CI-CD Pipeline_ Achieving Visual Perfection
Applitools
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Applitools
 
Streamlining Your Tech Stack: A Blueprint for Enhanced Efficiency and Coverag...
Streamlining Your Tech Stack: A Blueprint for Enhanced Efficiency and Coverag...Streamlining Your Tech Stack: A Blueprint for Enhanced Efficiency and Coverag...
Streamlining Your Tech Stack: A Blueprint for Enhanced Efficiency and Coverag...
Applitools
 
Visual AI for eCommerce: Improving Conversions with a Flawless UI
Visual AI for eCommerce: Improving Conversions with a Flawless UIVisual AI for eCommerce: Improving Conversions with a Flawless UI
Visual AI for eCommerce: Improving Conversions with a Flawless UI
Applitools
 
A Test Automation Platform Designed for the Future
A Test Automation Platform Designed for the FutureA Test Automation Platform Designed for the Future
A Test Automation Platform Designed for the Future
Applitools
 
Add AI to Your SDLC, presented by Applitools and Curiosity
Add AI to Your SDLC, presented by Applitools and CuriosityAdd AI to Your SDLC, presented by Applitools and Curiosity
Add AI to Your SDLC, presented by Applitools and Curiosity
Applitools
 
The Future of AI-Based Test Automation
The Future of AI-Based Test AutomationThe Future of AI-Based Test Automation
The Future of AI-Based Test Automation
Applitools
 
Test Automation at Scale: Lessons from Top-Performing Distributed Teams
Test Automation at Scale: Lessons from Top-Performing Distributed TeamsTest Automation at Scale: Lessons from Top-Performing Distributed Teams
Test Automation at Scale: Lessons from Top-Performing Distributed Teams
Applitools
 
Can AI Autogenerate and Run Automated Tests?
Can AI Autogenerate and Run Automated Tests?Can AI Autogenerate and Run Automated Tests?
Can AI Autogenerate and Run Automated Tests?
Applitools
 
Triple Assurance: AI-Powered Test Automation in UI Design and Functionality
Triple Assurance: AI-Powered Test Automation in UI Design and FunctionalityTriple Assurance: AI-Powered Test Automation in UI Design and Functionality
Triple Assurance: AI-Powered Test Automation in UI Design and Functionality
Applitools
 
Navigating the Challenges of Testing at Scale: Lessons from Top-Performing Teams
Navigating the Challenges of Testing at Scale: Lessons from Top-Performing TeamsNavigating the Challenges of Testing at Scale: Lessons from Top-Performing Teams
Navigating the Challenges of Testing at Scale: Lessons from Top-Performing Teams
Applitools
 
Introducing the Applitools Self Healing Execution Cloud.pdf
Introducing the Applitools Self Healing Execution Cloud.pdfIntroducing the Applitools Self Healing Execution Cloud.pdf
Introducing the Applitools Self Healing Execution Cloud.pdf
Applitools
 
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
Applitools
 
Collaborating From Design To Experience: Introducing Centra
Collaborating From Design To Experience: Introducing CentraCollaborating From Design To Experience: Introducing Centra
Collaborating From Design To Experience: Introducing Centra
Applitools
 
What the QA Position Will Look Like in the Future
What the QA Position Will Look Like in the FutureWhat the QA Position Will Look Like in the Future
What the QA Position Will Look Like in the Future
Applitools
 
Getting Started with Visual Testing
Getting Started with Visual TestingGetting Started with Visual Testing
Getting Started with Visual Testing
Applitools
 
Workshop: Head-to-Head Web Testing: Part 1 with Cypress
Workshop: Head-to-Head Web Testing: Part 1 with CypressWorkshop: Head-to-Head Web Testing: Part 1 with Cypress
Workshop: Head-to-Head Web Testing: Part 1 with Cypress
Applitools
 
From Washing Cars To Automating Test Applications
From Washing Cars To Automating Test ApplicationsFrom Washing Cars To Automating Test Applications
From Washing Cars To Automating Test Applications
Applitools
 
A Holistic Approach to Testing in Continuous Delivery
A Holistic Approach to Testing in Continuous DeliveryA Holistic Approach to Testing in Continuous Delivery
A Holistic Approach to Testing in Continuous Delivery
Applitools
 
AI-Powered-Cross-Browser Testing
AI-Powered-Cross-Browser TestingAI-Powered-Cross-Browser Testing
AI-Powered-Cross-Browser Testing
Applitools
 

More from Applitools (20)

Building the Ideal CI-CD Pipeline_ Achieving Visual Perfection
Building the Ideal CI-CD Pipeline_ Achieving Visual PerfectionBuilding the Ideal CI-CD Pipeline_ Achieving Visual Perfection
Building the Ideal CI-CD Pipeline_ Achieving Visual Perfection
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Streamlining Your Tech Stack: A Blueprint for Enhanced Efficiency and Coverag...
Streamlining Your Tech Stack: A Blueprint for Enhanced Efficiency and Coverag...Streamlining Your Tech Stack: A Blueprint for Enhanced Efficiency and Coverag...
Streamlining Your Tech Stack: A Blueprint for Enhanced Efficiency and Coverag...
 
Visual AI for eCommerce: Improving Conversions with a Flawless UI
Visual AI for eCommerce: Improving Conversions with a Flawless UIVisual AI for eCommerce: Improving Conversions with a Flawless UI
Visual AI for eCommerce: Improving Conversions with a Flawless UI
 
A Test Automation Platform Designed for the Future
A Test Automation Platform Designed for the FutureA Test Automation Platform Designed for the Future
A Test Automation Platform Designed for the Future
 
Add AI to Your SDLC, presented by Applitools and Curiosity
Add AI to Your SDLC, presented by Applitools and CuriosityAdd AI to Your SDLC, presented by Applitools and Curiosity
Add AI to Your SDLC, presented by Applitools and Curiosity
 
The Future of AI-Based Test Automation
The Future of AI-Based Test AutomationThe Future of AI-Based Test Automation
The Future of AI-Based Test Automation
 
Test Automation at Scale: Lessons from Top-Performing Distributed Teams
Test Automation at Scale: Lessons from Top-Performing Distributed TeamsTest Automation at Scale: Lessons from Top-Performing Distributed Teams
Test Automation at Scale: Lessons from Top-Performing Distributed Teams
 
Can AI Autogenerate and Run Automated Tests?
Can AI Autogenerate and Run Automated Tests?Can AI Autogenerate and Run Automated Tests?
Can AI Autogenerate and Run Automated Tests?
 
Triple Assurance: AI-Powered Test Automation in UI Design and Functionality
Triple Assurance: AI-Powered Test Automation in UI Design and FunctionalityTriple Assurance: AI-Powered Test Automation in UI Design and Functionality
Triple Assurance: AI-Powered Test Automation in UI Design and Functionality
 
Navigating the Challenges of Testing at Scale: Lessons from Top-Performing Teams
Navigating the Challenges of Testing at Scale: Lessons from Top-Performing TeamsNavigating the Challenges of Testing at Scale: Lessons from Top-Performing Teams
Navigating the Challenges of Testing at Scale: Lessons from Top-Performing Teams
 
Introducing the Applitools Self Healing Execution Cloud.pdf
Introducing the Applitools Self Healing Execution Cloud.pdfIntroducing the Applitools Self Healing Execution Cloud.pdf
Introducing the Applitools Self Healing Execution Cloud.pdf
 
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
 
Collaborating From Design To Experience: Introducing Centra
Collaborating From Design To Experience: Introducing CentraCollaborating From Design To Experience: Introducing Centra
Collaborating From Design To Experience: Introducing Centra
 
What the QA Position Will Look Like in the Future
What the QA Position Will Look Like in the FutureWhat the QA Position Will Look Like in the Future
What the QA Position Will Look Like in the Future
 
Getting Started with Visual Testing
Getting Started with Visual TestingGetting Started with Visual Testing
Getting Started with Visual Testing
 
Workshop: Head-to-Head Web Testing: Part 1 with Cypress
Workshop: Head-to-Head Web Testing: Part 1 with CypressWorkshop: Head-to-Head Web Testing: Part 1 with Cypress
Workshop: Head-to-Head Web Testing: Part 1 with Cypress
 
From Washing Cars To Automating Test Applications
From Washing Cars To Automating Test ApplicationsFrom Washing Cars To Automating Test Applications
From Washing Cars To Automating Test Applications
 
A Holistic Approach to Testing in Continuous Delivery
A Holistic Approach to Testing in Continuous DeliveryA Holistic Approach to Testing in Continuous Delivery
A Holistic Approach to Testing in Continuous Delivery
 
AI-Powered-Cross-Browser Testing
AI-Powered-Cross-Browser TestingAI-Powered-Cross-Browser Testing
AI-Powered-Cross-Browser Testing
 

Recently uploaded

ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
Luigi Fugaro
 
Beginner's Guide to Observability@Devoxx PL 2024
Beginner's  Guide to Observability@Devoxx PL 2024Beginner's  Guide to Observability@Devoxx PL 2024
Beginner's Guide to Observability@Devoxx PL 2024
michniczscribd
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio, Inc.
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
Pedro J. Molina
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
ervikas4
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
aeeva
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
sandeepmenon62
 
Optimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptxOptimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptx
WebConnect Pvt Ltd
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
kalichargn70th171
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
Jhone kinadey
 

Recently uploaded (20)

ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
 
Beginner's Guide to Observability@Devoxx PL 2024
Beginner's  Guide to Observability@Devoxx PL 2024Beginner's  Guide to Observability@Devoxx PL 2024
Beginner's Guide to Observability@Devoxx PL 2024
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
 
bgiolcb
bgiolcbbgiolcb
bgiolcb
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
 
Optimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptxOptimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptx
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
 

Workshop: Introduction to Performance and Load Testing with k6

  • 1. Introduction to Performance & Load With k6 Leandro Melendez Performance Advocate, k6
  • 2. Who am I? ❑Leandro AKA Señor Performo ❑DevRel Perf @k6_io ❑Blog (www.srperf.com) ❑Host of PerfBytes ❑Youtube ❑Book Author
  • 4. “Performance testing: validate and verify how fast and efficient is the SW under different scenarios”
  • 5.
  • 6. Performance Testing Load testing Synthetics RUM SRE Single thread Much more…
  • 7. “Load testing is the process of putting demand on a system and measuring its response”
  • 8. Answers from performance testing Load Reliability Observability In which conditions my system reaches its limits and breaks? How does my system’s performance evolve over the time? Can my system handle the target load? Performance How fast and efficient is my system?
  • 9. Modern teams shifting performance testing left & right Testing frequency Release frequency What to test How is performance testing initiated When to test Who is responsible for performance testing OLD WAY Quarterly or biannually QA Load tests through user stories Manually Before releases After all Dev and QA, right before release NEW WAY Weekly Developers, QA/SDET, SRE Continuously: at code check-in, nightly/weekly, when infra changes, before releases Multiple scenarios through user stories, services, infrastructure Automatically and continuously as part of CI/CD Continuously through the SDLC and in prod What are the incentives Misaligned between functions Aligned incentives of SLOs & Error budgets
  • 10. k6.io What is k6? 1 2 3 4 An Open Source load testing tool Programmable Simple, yet powerful Extensible and easy to use “Although it's easy to get started with k6 all on its own, it really shines with its ease of integration into a developer ecosystem.” Thoughtworks
  • 11. Extensible? Wha dat? Output Testing Misc ChaiJS xk6-mock xk6-cache xk6-cognito etc xk6-disruptor xk6-crypto xk6-docker xk6-ethereum etc xk6-prometheus xk6-datadog xk6-es xk6-file etc Protocols xk6-Browser xk6-sql xk6-tcp xk6-smtp etc
  • 14. Many Several 1 user What to perf test
  • 15. Protocol Back End Front End Automation types
  • 16. Protocol Back End Front End Automation types
  • 18. Simulating user flows and workload modeling, adding think time Setting SLOs for the system under load Using dynamically generated or random values Scenarios Thresholds Test data More concepts
  • 23.
  • 26. $ k6 run [script.js] Run k6
  • 27. But wait, there’s more! Options k6 run --[Option] [optionValue] [script.js] k6 run --[Option1] [optionValue] [script.js] $ k6 run [script.js] Test, VUs, scenarios, instances, etc Run k6
  • 28. But wait, there’s more! Options k6 run --[Option] [optionValue] [script.js] k6 run --[Option1] [optionValue] [script.js] $ k6 run [script.js] Test, VUs, scenarios, instances, etc $ k6 run --vus 10 --duration 30s script.js Run k6
  • 29. Counters - sum values Gauges - track the smallest, largest, and latest values Rates - track how frequently a non-zero value occurs Trends - calculate statistics for multiple values Metrics Output
  • 35. import http from 'k6/http'; import { Trend } from 'k6/metrics'; const myTrend = new Trend('waiting_time'); export default function () { const r = http.get('https://httpbin.test.k6.io'); myTrend.add(r.timings.waiting); console.log(myTrend.name); // waiting_time } Custom Metrics! Output
  • 36. Metrics and results output Local LG CSV & JSON External services Prometheus Grafana Cloud k6 Cloud Amzn CW InfluxDb DataDog New Relic etc Visualizations Team
  • 37. $ k6 run --out json=test.json --out influxdb=http://localhost:8086/k6 $ k6 run --out json=test_results.gz script.js Send results elsewhere Output
  • 38. Checks - validate boolean conditions in your test. Checks & Thresholds Thresholds - pass/fail criteria that you define for your test metrics
  • 39. import { check } from 'k6'; import http from 'k6/http'; export default function () { const res = http.get('http://test.k6.io/'); check(res, { 'is status 200': (r) => r.status === 200, }); } Check HTTP response Check
  • 40. import { check } from 'k6'; import http from 'k6/http'; export default function () { const res = http.get('http://test.k6.io/'); check(res, { 'verify homepage text': (r) => r.body.includes('Collection of simple'), }); } Check for text in response body Check
  • 41. export const options = { thresholds: { metric_name1: ['threshold_expression', `...`], // short format metric_name2: [ { threshold: 'threshold_expression', abortOnFail: true, // boolean delayAbortEval: '10s', // string }, ], // full format }, }; Syntax Threshold
  • 42. import http from 'k6/http'; export const options = { thresholds: { http_req_failed: ['rate<0.01'], // http errors should be less than 1% }, }; export default function () { http.get('https://test-api.k6.io/public/crocodiles/1/'); } HTTP errors Threshold
  • 43. import http from 'k6/http'; export const options = { thresholds: { http_req_failed: ['rate<0.01'], // http errors should be less than 1% http_req_duration: ['p(95)<200'], // 95% of requests should be below 200ms }, }; export default function () { http.get('https://test-api.k6.io/public/crocodiles/1/'); } HTTP errors and response duration Threshold
  • 45.
  • 46. ● k6: k6.io / github.com/grafana/k6 ● Documentation k6: k6.io/docs ● k6-Learn initiative: github/grafana/k6-learn ● k6 in youtube: youtube.com/@k6io ● k6 awesome & examples: github/grafana/k6-learn github/grafana/k6/samples k6.io/slack grafana/k6 community.k6.io k6 Resources