Fortio - load testing tool
Fortio is load testing tool, which runs at a specified query per second (qps) and records an histogram of execution time and calculates percentiles. Detailed description how to install and use Fortio can be found on GitHub. Below I present simple examples on Kubernetes.
Load test using fortio
were prepared as job, where we are going to test 3 different applications running in pods:
> cat tests/fortio.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: load-tests
namespace: app-load-test
spec:
parallelism: 2
template:
metadata:
annotations:
prometheus.io/scrape: "false"
spec:
restartPolicy: Never
containers:
- name: test-app1
image: fortio/fortio:1.17.0
command: ["fortio", "load", "-c", "8", "-qps", "12", "-t", "60s", "-allow-initial-errors", "http://app1:8081"]
- name: test-app2
image: fortio/fortio:1.17.0
command: ["fortio", "load", "-c", "8", "-qps", "12", "-t", "60s", "-allow-initial-errors", "http://app2:8082"]
- name: test-app3-blue
image: fortio/fortio:1.17.0
command: ["fortio", "load", "-c", "8", "-qps", "12", "-t", "60s", "-allow-initial-errors", "http://app3:8082"]
Job can be created usling below commands:
> kubectl apply -f tests/fortio.yaml
job.batch/load-tests created
> kubectl get jobs -n app-load-test
NAME COMPLETIONS DURATION AGE
load-tests 0/1 of 2 65s 65s
> kubectl get pods -n app-load-test
NAME READY STATUS RESTARTS AGE
app1-6c57b4b6d-df69l 0/1 Running 1 4m17s
app2-5f89894c98-9v7wb 1/1 Running 0 97m
app3-5bb6b4877-qdq8j 2/2 Running 1 25m
load-tests-6849q 3/3 Running 0 73s
load-tests-nx7dl 3/3 Running 0 73s