Difference between revisions of "Performance testing tools"
Jump to navigation
Jump to search
(→Vegeta) |
(→Vegeta) |
||
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 47: | Line 62: | ||
Operations | Operations on a pod | ||
<source lang=bash> | <source lang=bash> | ||
URL=http://example.com/healthcheck | URL=http://example.com/healthcheck | ||
NAME=example.com | |||
RATE=50/1s | |||
DURATION=600s | |||
echo | DIR=/results | ||
cat results.bin | vegeta plot -title $URL > plot.html | FILE=$DIR/$DATE-$NAME-r$RATE-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 | |||
# | -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 |
Revision as of 23:27, 24 June 2021
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
<syntaxhighlightjs lang="yaml">
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 </syntaxhighlightjs>
Operations on a pod
URL=http://example.com/healthcheck NAME=example.com RATE=50/1s DURATION=600s DIR=/results FILE=$DIR/$DATE-$NAME-r$RATE-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 # | -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