61 lines
2.1 KiB
Markdown
61 lines
2.1 KiB
Markdown
<!-- #build4 -->
|
|
# bench plugin
|
|
|
|
### Docker Run
|
|
|
|
Run the Docker image using the `docker run` command. I'll provide examples for different scenarios:
|
|
|
|
1. **Testing a Single URL:**
|
|
|
|
```bash
|
|
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
|
|
```
|
|
|
|
2. **Testing Multiple URLs:**
|
|
|
|
```bash
|
|
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
|
|
```
|
|
|
|
3. **Using Fail-Fast Mode:**
|
|
|
|
```bash
|
|
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:
|
|
|
|
```yaml
|
|
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:
|
|
|
|
```bash
|
|
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, either `report` to test all URLs regardless of individual results, or `fail-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. |