Flux is a fast, Docker-only load testing tool written in Rust.
1.7K
Flux is a fast, Docker-only load testing tool written in Rust.
No installation.
No dependencies.
Just Docker + YAML.
docker build -t flux:latest .
mkdir -p data results
data/ (for multipart uploads)echo "Sample file content" > data/sample.txt
config.yamlSee the samples/ folder for examples.
docker run --rm \
-v $(pwd)/config.yaml:/app/config.yaml \
-v $(pwd)/data:/app/data \
-v $(pwd)/results:/app/results \
flux:latest
target: "https://api.example.com/endpoint"
method: "GET"
headers:
Accept: "application/json"
concurrency: 20
duration: "30s"
mode: "async"
output:
json: "/app/results/output.json"
html: "/app/results/report.html"
target: "https://api.example.com/users"
method: "POST"
headers:
Content-Type: "application/json"
body: |
{
"username": "test",
"email": "[email protected]"
}
concurrency: 10
duration: "15s"
mode: "async"
output:
json: "/app/results/output.json"
html: "/app/results/report.html"
target: "https://api.example.com/upload"
method: "POST"
multipart:
- type: "file"
name: "avatar"
path: "/app/data/avatar.png"
- type: "field"
name: "username"
value: "john"
- type: "field"
name: "age"
value: "25"
concurrency: 5
duration: "10s"
mode: "async"
output:
json: "/app/results/output.json"
html: "/app/results/report.html"
target: "https://api.example.com"
scenarios:
- name: "login"
method: "POST"
url: "/auth/login"
headers:
Content-Type: "application/json"
body: |
{
"username": "test",
"password": "secret"
}
extract:
token: "$.access_token"
user_id: "$.user.id"
- name: "get-profile"
method: "GET"
url: "/users/{{ user_id }}/profile"
headers:
Authorization: "Bearer {{ token }}"
depends_on: "login"
- name: "update-profile"
method: "PUT"
url: "/users/{{ user_id }}/profile"
headers:
Authorization: "Bearer {{ token }}"
Content-Type: "application/json"
body: |
{
"bio": "Updated bio"
}
depends_on: "get-profile"
concurrency: 10
duration: "30s"
mode: "async"
output:
json: "/app/results/output.json"
html: "/app/results/report.html"
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
target | string | Yes* | - | Base URL for requests |
method | string | No | GET | HTTP method (GET, POST, PUT, DELETE, etc.) |
headers | map | No | {} | HTTP headers |
body | string | No | - | Request body (ignored if multipart is set) |
multipart | array | No | - | Multipart form data |
scenarios | array | No | [] | Multi-step scenarios |
concurrency | integer | No | 10 | Number of concurrent workers |
duration | string | No | 30s | Test duration (e.g., "30s", "5m", "1h") |
mode | string | No | async | Execution mode: "async" or "sync" |
output | object | Yes | - | Output configuration |
* Required if not using scenarios with full URLs
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | "file" or "field" |
name | string | Yes | Form field name |
path | string | Yes (for file) | File path (must be in /app/data) |
value | string | Yes (for field) | Field value |
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Step name |
method | string | Yes | HTTP method |
url | string | Yes | URL path or full URL |
headers | map | No | HTTP headers |
body | string | No | Request body |
multipart | array | No | Multipart form data |
extract | map | No | JSONPath extraction rules |
depends_on | string | No | Name of step this depends on |
Use JSONPath syntax to extract values from JSON responses:
extract:
token: "$.access_token"
user_id: "$.user.id"
email: "$.user.email"
Then use extracted variables with {{ variable_name }} syntax:
headers:
Authorization: "Bearer {{ token }}"
url: "/users/{{ user_id }}/profile"
Flux collects comprehensive metrics for each request:
Contains full raw data and summary statistics:
{
"summary": {
"total_requests": 12430,
"successful_requests": 12002,
"failed_requests": 428,
"throughput_rps": 414.33,
"p50_latency_ms": 84,
"p90_latency_ms": 152,
"p99_latency_ms": 231,
"error_rate": 3.44
},
"results": [...]
}
Beautiful interactive report with:
Uses Tokio for maximum concurrency. Recommended for most use cases.
mode: "async"
concurrency: 100
Blocking workers with controlled request rate. Useful for testing rate limiting.
mode: "sync"
concurrency: 10
docker run --rm \
-v ./config.yaml:/app/config.yaml \
-v ./data:/app/data \
-v ./results:/app/results \
flux:latest
docker run --rm \
-e RUST_LOG=debug \
-v ./config.yaml:/app/config.yaml \
-v ./data:/app/data \
-v ./results:/app/results \
flux:latest
/app/config.yaml - Configuration file (required)/app/data - Directory for multipart files (optional)/app/results - Directory for output reports (required)cargo build --release
./target/release/flux
docker build -t flux:latest .
See the samples/ directory for complete examples:
simple-get.yaml - Basic GET requestsimple-post.yaml - POST with JSON bodymultipart-upload.yaml - File upload with multipartscenario-auth.yaml - Multi-step authentication flowflux/
āāā src/
ā āāā main.rs # Entry point and orchestration
ā āāā config.rs # YAML configuration parsing
ā āāā client.rs # HTTP client wrapper
ā āāā executor.rs # Load test execution engine
ā āāā metrics.rs # Metrics collection
ā āāā reporter.rs # Report generation
ā āāā ui.rs # Terminal UI
ā āāā templates/
ā āāā report.html # HTML report template
āāā samples/
ā āāā simple-get.yaml # GET example
ā āāā simple-post.yaml # POST example
ā āāā multipart-upload.yaml # Upload example
ā āāā scenario-auth.yaml # Scenario example
ā āāā sample.txt # Sample file
āāā data/ # Directory for multipart files
āāā results/ # Directory for output reports
āāā Cargo.toml # Rust dependencies
āāā Cargo.lock # Dependency lock file
āāā Dockerfile # Container image definition
āāā Makefile # Build and development commands
āāā build.sh # Build script
āāā run-example.sh # Run script
āāā config.yaml # Default configuration
āāā README.md # This file
āāā IMPLEMENTATION.md # Implementation details
āāā QUICKSTART.md # Quick start guide
For detailed implementation information, architecture, and technical decisions, see IMPLEMENTATION.mdā .
cargo test
cargo fmt
cargo clippy
Contributions are welcome! Please ensure:
Built with ā¤ļø using Rust
Content type
Image
Digest
sha256:f91fcf0a4ā¦
Size
35.9 MB
Last updated
about 1 month ago
docker pull ragilhadi/flux