Difference between revisions of "Performance testing tools"
Jump to navigation
Jump to search
(→Vegeta) |
|||
| (6 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
= [https://github.com/tsenart/vegeta Vegeta] = | = [https://github.com/tsenart/vegeta Vegeta] = | ||
== Standalone install == | |||
<source lang=bash> | |||
LATEST=$(curl --silent "https://api.github.com/repos/tsenart/vegeta/releases/latest" | jq -r .tag_name | tr -d "v"); echo $LATEST | |||
TEMPDIR=$(mktemp -d) | |||
curl -L https://github.com/tsenart/vegeta/releases/download/v${LATEST}/vegeta_${LATEST}_linux_amd64.tar.gz -o $TEMPDIR/vegeta_${LATEST}_linux_amd64.tar.gz | |||
sudo tar xzvf $TEMPDIR/vegeta_${LATEST}_linux_amd64.tar.gz -C /usr/local/bin vegeta | |||
vegeta -version | |||
Version: | |||
Commit: | |||
Runtime: go1.14.2 linux/amd64 | |||
Date: | |||
</source> | |||
== Docker and Kubernetes == | |||
Docker images | Docker images | ||
* https://github.com/peter-evans/vegeta-docker | * https://github.com/peter-evans/vegeta-docker | ||
| Line 6: | Line 21: | ||
Kubernetes deployment | Kubernetes deployment | ||
< | <source lang="yaml"> | ||
kubectl apply -f <(cat <<EOF | kubectl apply -f <(cat <<EOF | ||
apiVersion: apps/v1 | apiVersion: apps/v1 | ||
| Line 44: | Line 59: | ||
EOF | EOF | ||
) --dry-run=server | ) --dry-run=server | ||
</ | </source> | ||
Operations | == Operations == | ||
<source lang=bash> | <source lang=bash> | ||
URL=http://example.com/healthcheck | URL=http://example.com/healthcheck | ||
NAME=example.com | |||
RATE=50/1s | |||
DURATION=600s | |||
DIR=/results | |||
FILE=$DIR/$DATE-$NAME-r${RATE/\//in}-d$DURATION | |||
DATE=$(date +"%Y%m%d-%H%M"); echo $DATE | |||
echo "GET $URL" | vegeta attack -name $NAME -rate=$RATE -duration=$DURATION -timeout=120s | tee $FILE-results.bin | vegeta report | |||
cat $FILE-results.bin | vegeta plot -title $URL > $FILE-plot.html | |||
cat $FILE-results.bin | vegeta report # print report again | |||
# Multi target | |||
vegeta attack -name $NAME -rate=$RATE -duration=$DURATION -timeout=120s -targets=<(cat <<EOF | |||
GET http://example1.com/healthcheck | |||
GET http://example2.com/healthcheck | |||
EOF | |||
) | tee $FILE-results.bin | vegeta report | |||
# | # | -cpus int Number of CPUs to use (default 8) | ||
# | attack | |||
# | -duration duration Duration of the test [0 = forever] | |||
# | -name string Attack name | |||
# | -output string Output file (default "stdout") | |||
# | -rate value Number of requests per time unit [0 = infinity] (default 50/1s) | |||
# | -targets string Targets file (default "stdin") | |||
# | -workers uint Initial number of workers (default 10) | |||
# | plot | |||
# | -output string Output file (default "stdout") | |||
# | -title string Title and header of the resulting HTML page (default "Vegeta Plot") | |||
# | report | |||
# | -output string Output file (default "stdout") | |||
# | -type string Report type to generate [text, json, hist[buckets], hdrplot] (default "text") | |||
# On a laptop | # On a laptop | ||
| Line 61: | Line 101: | ||
= Repositories = | = Repositories = | ||
* [https://devops.com/infrastructure-validation-with-inspec/ | * [https://devops.com/infrastructure-validation-with-inspec/ chef-inspec] infrastructure compliance tool | ||
** [https://community.chef.io/tools/chef-inspec chef-inspec] | |||
Latest revision as of 10:26, 1 March 2024
Vegeta
Standalone install
LATEST=$(curl --silent "https://api.github.com/repos/tsenart/vegeta/releases/latest" | jq -r .tag_name | tr -d "v"); echo $LATEST
TEMPDIR=$(mktemp -d)
curl -L https://github.com/tsenart/vegeta/releases/download/v${LATEST}/vegeta_${LATEST}_linux_amd64.tar.gz -o $TEMPDIR/vegeta_${LATEST}_linux_amd64.tar.gz
sudo tar xzvf $TEMPDIR/vegeta_${LATEST}_linux_amd64.tar.gz -C /usr/local/bin vegeta
vegeta -version
Version:
Commit:
Runtime: go1.14.2 linux/amd64
Date:
Docker and Kubernetes
Docker images
Kubernetes deployment
kubectl apply -f <(cat <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: vegeta
labels:
app: vegeta
spec:
replicas: 1
selector:
matchLabels:
app: vegeta
template:
metadata:
labels:
app: vegeta
spec:
containers:
- name: vegeta
image: peterevans/vegeta:6.9.1-vegeta12.8.4
args:
- sh
- -c
- sleep 36000 # 3600
ports:
- containerPort: 80
resources:
limits:
cpu: 4000m # '1'
memory: 1Gi
requests:
cpu: 2000m # '1'
memory: 1Gi
nodeSelector:
node.kubernetes.io/lifecycle: spot
EOF
) --dry-run=server
Operations
URL=http://example.com/healthcheck
NAME=example.com
RATE=50/1s
DURATION=600s
DIR=/results
FILE=$DIR/$DATE-$NAME-r${RATE/\//in}-d$DURATION
DATE=$(date +"%Y%m%d-%H%M"); echo $DATE
echo "GET $URL" | vegeta attack -name $NAME -rate=$RATE -duration=$DURATION -timeout=120s | tee $FILE-results.bin | vegeta report
cat $FILE-results.bin | vegeta plot -title $URL > $FILE-plot.html
cat $FILE-results.bin | vegeta report # print report again
# Multi target
vegeta attack -name $NAME -rate=$RATE -duration=$DURATION -timeout=120s -targets=<(cat <<EOF
GET http://example1.com/healthcheck
GET http://example2.com/healthcheck
EOF
) | tee $FILE-results.bin | vegeta report
# | -cpus int Number of CPUs to use (default 8)
# | attack
# | -duration duration Duration of the test [0 = forever]
# | -name string Attack name
# | -output string Output file (default "stdout")
# | -rate value Number of requests per time unit [0 = infinity] (default 50/1s)
# | -targets string Targets file (default "stdin")
# | -workers uint Initial number of workers (default 10)
# | plot
# | -output string Output file (default "stdout")
# | -title string Title and header of the resulting HTML page (default "Vegeta Plot")
# | report
# | -output string Output file (default "stdout")
# | -type string Report type to generate [text, json, hist[buckets], hdrplot] (default "text")
# On a laptop
kubectl cp vegeta/vegeta-5847d879d8-p9kqw:plot.html ./plot.html -c vegeta
Repositories
- chef-inspec infrastructure compliance tool