Update README.md

This commit is contained in:
colin 2024-02-18 18:06:44 +00:00
parent 99f02b6438
commit 06ed74d1bc
1 changed files with 19 additions and 24 deletions

View File

@ -1,31 +1,26 @@
<!-- #build4 --> <!-- #build0 -->
```markdown
# bench plugin # bench plugin
### Docker Run ### Docker Run
Run the Docker image using the `docker run` command. I'll provide examples for different scenarios: Run the Docker image using the `docker run` command. Here are examples adjusted for the new environment variables:
1. **Testing a Single URL:** 1. **Testing a Single URL:**
```bash ```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 docker run -e URLS="http://example.com" -e USERNAME="user" -e PASSWORD="pass" git.nixc.us/colin/bench:production
``` ```
2. **Testing Multiple URLs:** 2. **Testing Multiple URLs:**
```bash ```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 docker run -e URLS="http://example.com,http://example2.com" -e USERNAME="user" -e PASSWORD="pass" 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 ### Docker Compose
Example `docker-compose.yml` file that sets up the same configuration: Example `docker-compose.yml` file adjusted for the new script:
```yaml ```yaml
version: '3' version: '3'
@ -34,16 +29,15 @@ services:
apachebench: apachebench:
image: git.nixc.us/colin/bench:production image: git.nixc.us/colin/bench:production
environment: environment:
TARGET_URLS: "http://example.com,http://example2.com" # Comma-separated list of URLs URLS: "http://example.com,http://example2.com" # Comma-separated list of URLs
MAX_TIME: 1 # Maximum acceptable response time USERNAME: "user" # Basic auth username
VARIANCE: 2 # Acceptable time variance PASSWORD: "pass" # Basic auth password
TEST_MODE: "report" # Can be "report" or "fail-fast" REQUESTS: 100 # Number of requests for Apache Bench
NUM_REQUESTS: 500 # Number of requests to perform CONCURRENCY: 10 # Number of multiple requests to make at a time
CONCURRENCY: 20 # Number of multiple requests to make at a time
``` ```
Run the service defined in the `docker-compose.yml` file, use: Run the service defined in the `docker-compose.yml` file with:
```bash ```bash
docker-compose up docker-compose up
@ -51,11 +45,12 @@ docker-compose up
### Customizing the Configuration ### 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: Adjust the `URLS`, `USERNAME`, `PASSWORD`, `REQUESTS`, and `CONCURRENCY` environment variables to meet your testing needs. Here's the purpose of each:
- `TARGET_URLS`: A comma-separated list of URLs to test. - `URLS`: Comma-separated list of URLs to test.
- `MAX_TIME`: The target maximum response time in seconds. - `USERNAME` and `PASSWORD`: Credentials for HTTP Basic Authentication.
- `VARIANCE`: The acceptable variance in response time in seconds. - `REQUESTS`: Number of requests to perform with Apache Bench.
- `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. - `CONCURRENCY`: Number of multiple requests to make at a time.
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. This setup allows you to run authenticated performance tests in a Docker environment, offering an automated approach to benchmarking and analyzing the performance of web services.
```