Difference between revisions of "Performance testing tools"
Jump to navigation
Jump to search
(4 intermediate revisions by the same user not shown) | |||
Line 21: | 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 59: | 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 | ||
Line 69: | Line 68: | ||
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 | ||
cat $FILE-results.bin | vegeta plot -title $URL > $FILE-plot.html | cat $FILE-results.bin | vegeta plot -title $URL > $FILE-plot.html | ||
cat $FILE-results.bin | vegeta report | 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) | # | -cpus int Number of CPUs to use (default 8) | ||
# | attack | # | attack | ||
Line 94: | 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