Difference between revisions of "Performance testing tools"
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
| Line 69: | Line 69: | ||
| DURATION=600s | DURATION=600s | ||
| DIR=/results | DIR=/results | ||
| FILE=$DIR/$DATE-$NAME-r${RATE/\// | FILE=$DIR/$DATE-$NAME-r${RATE/\//in}-d$DURATION | ||
| DATE=$(date +"%Y%m%d-%H%M"); echo $DATE | 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 | echo "GET $URL" | vegeta attack -name $NAME -rate=$RATE -duration=$DURATION -timeout=120s | tee $FILE-results.bin | vegeta report | ||
Revision as of 23:37, 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/\//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
# | -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