![]() |
||
---|---|---|
docker/bench | ||
.woodpecker.yml | ||
README.md | ||
docker-compose.production.yml | ||
docker-compose.staging.yml |
README.md
bench plugin
Docker Run
Run the Docker image using the docker run
command. I'll provide examples for different scenarios:
-
Testing a Single URL:
docker run -e TARGET_URLS="http://example.com" -e MAX_TIME=1 -e VARIANCE=2 -e TEST_MODE="report" git.nixc.us/colin/bench:production
-
Testing Multiple URLs:
docker run -e TARGET_URLS="http://example.com,http://example2.com" -e MAX_TIME=1 -e VARIANCE=2 -e TEST_MODE="report" git.nixc.us/colin/bench:production
-
Using Fail-Fast Mode:
docker run -e TARGET_URLS="http://example.com" -e MAX_TIME=1 -e VARIANCE=2 -e TEST_MODE="fail-fast" git.nixc.us/colin/bench:production
Docker Compose
Example docker-compose.yml
file that sets up the same configuration:
version: '3'
services:
apachebench:
image: git.nixc.us/colin/bench:production
environment:
TARGET_URLS: "http://example.com,http://example2.com" # Comma-separated list of URLs
MAX_TIME: 1 # Maximum acceptable response time
VARIANCE: 2 # Acceptable time variance
TEST_MODE: "report" # Can be "report" or "fail-fast"
NUM_REQUESTS: 500 # Number of requests to perform
CONCURRENCY: 20 # Number of multiple requests to make at a time
Run the service defined in the docker-compose.yml
file, use:
docker-compose up
Customizing the Configuration
You can modify the TARGET_URLS
, MAX_TIME
, VARIANCE
, and TEST_MODE
environment variables to suit your specific testing needs. Here's what each variable represents:
TARGET_URLS
: A comma-separated list of URLs to test.MAX_TIME
: The target maximum response time in seconds.VARIANCE
: The acceptable variance in response time in seconds.TEST_MODE
: The mode of operation, eitherreport
to test all URLs regardless of individual results, orfail-fast
to stop testing as soon as a URL fails the performance criteria.
This setup allows you to run performance tests in a Docker environment, providing an automated way to benchmark and analyze the performance of various web services.