Sign inSign up

bmarinov/vegeta

By bmarinov

Updated almost 6 years ago

Vegeta in container. Pretty much.

Image
0

1.0K

bmarinov/vegeta repository overview

Vegeta

A containerized version of Vegeta, a HTTP load testing tool. The binary is packaged as-is from the releases page.

This is not an official image.

Getting Started

This dockerized version of Vegeta can be deployed on any host or platform that supports container workloads.

This is not an official image so please verify that the binary in the container matches the official release from tsenart/vegeta. The docker manifest is also worth checking out. This is for your own safety.

Prerequisities
  • Docker.

Usage

Plain Docker

The image can be used similarly to the CLI tool. The default entrypoint is /bin/sh -c and vegeta is on the PATH.

Pass the CLI args and the vegeta commands as usual. Surround all command ARGs with double quotes.

  • Report:

    The default source for the target URL is STDIN.
    The echo output can be piped into the vegeta stdin. No differences here.

docker run bmarinov/vegeta \
    "echo GET https://localhost:8080 | vegeta attack -rate=150 -duration=5s | vegeta report"
  • Report & Output to File:

    Outputting results to a file should be done via a docker mount. Otherwise no differences with the normal vegeta usage. Configuration files can be read in the same manner.

docker run \
    --volume ~/dev/vegeta/reports:/data \
    bmarinov/vegeta \
    "echo GET https://localhost:8080 | vegeta attack -duration=5s \
        | tee /data/results.bin | vegeta report"
  • Plot

    Similar to the previous example.

docker run \
    --volume ~/dev/vegeta/reports:/data \
    bmarinov/vegeta \
    "echo GET https://localhost:8080 | vegeta attack -duration=5s \
        | tee /data/results.bin | vegeta report && \
        cat /data/results.bin | vegeta plot > /data/plot.html"

More details and usage examples can be found in the project documentation on GitHub.

Volumes

Volumes for the Vegeta input or output can be declared in the docker run command. Use the --volume or --mount flag to specify the host directory and the mount point inside the container.

  • 'docker run --volume ~/dev/vegeta/data:/data ..'
    => Mount ~/dev/vegeta/data on the host at /data in the container.

  • 'docker run --mount type=bind,source=$(pwd)/reports,target=/data ..'
    => Mounts the ./reports subdirectory. Otherwise same as above.

From Kubernetes

Running the load tests as a k8s job requires several line of human-(un)readable markup.

apiVersion: batch/v1
kind: Job
metadata:
  name: blast
spec:
  template:
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - app-devserver
            topologyKey: "kubernetes.io/hostname"
      containers:
      - name: over9000
        image: bmarinov/vegeta:12.8.4
        args: [ "echo GET https://service-name/api/resource | vegeta attack -duration=12s -rate=500 | vegeta report" ]
      restartPolicy: Never

The anti-affinity should prevent the pod from running on the same nodes as the application under test. Update the selector to match your app.

Running the tests in a pod is a bit of a pain if you want easy access to the results or plots, but is otherwise great for continuous load tests.

Versioning

Tags follow the official release versions. Additional tags specify the build date and the revision in the [major.minor.patch]-[yyyymmdd.revision] format.
The available versions can be found on the tags page for this repository.

Authors

  • Tomás Senart - Vegeta, Maintainer and author - GitHub

  • Me - Mashing buttons and docker commands

License

This project is licensed under the MIT License - LICENSE file for details.

Tag summary

Content type

Image

Digest

Size

7.7 MB

Last updated

almost 6 years ago

docker pull bmarinov/vegeta