Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active April 25, 2024 04:12
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save vfarcic/fda147804b59fd2a0cbb5fb5deb4d00b to your computer and use it in GitHub Desktop.
Save vfarcic/fda147804b59fd2a0cbb5fb5deb4d00b to your computer and use it in GitHub Desktop.
# Source: https://gist.github.com/fda147804b59fd2a0cbb5fb5deb4d00b
##################################################################
# The Best Performance And Load Testing Tool? k6 By Grafana Labs #
# https://youtu.be/wfanR-Ps-lk #
##################################################################
# Additional Info:
# - k6: https://k6.io
# - Google Cloud Run (GCR) vs Azure Container Instances (ACI) vs AWS ECS with Fargate: https://youtu.be/Jq8MY1ZGjno
#########
# Setup #
#########
# Install the `k6` CLI from https://k6.io/docs/getting-started/installation
git clone https://github.com/vfarcic/k6-demo
cd k6-demo
#############
# k6 Syntax #
#############
cat simple.js
##########################
# Run Load Tests With k6 #
##########################
k6 run simple.js
# Open https://k6.io/docs/using-k6/metrics/
k6 run --vus 10 --duration 30s simple.js
##############
# k6 Options #
##############
cat massive.js
# Open https://k6.io/docs/using-k6/options/
k6 run massive.js
#############
# k6 Stages #
#############
cat stages.js
k6 run stages.js
echo $?
####################################
# k6 Thresholds In CI/CD Pipelines #
####################################
cat ci.js
k6 run ci.js
echo $?
############
# k6 Cloud #
############
# Open https://k6.io + `TRY FOR FREE`
# Open https://app.k6.io
# Replace `[...]` with the token
export K6_TOKEN=[...]
k6 login cloud --token $K6_TOKEN
k6 cloud ci.js
##############
# k6 Pricing #
##############
# https://k6.io/pricing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment