This tool has been modified to read configuration exclusively from YAML files, similar to the Node.js Redis test app format.
./hitless-tool workloads/example-workload.yaml
The tool now accepts a single argument: the path to the YAML configuration file.
The YAML configuration follows this structure:
runner:
redis:
host: "127.0.0.1"
port: 6379
username: ""
password: ""
database: 0
timeout: "5s"
test:
mode: "standalone" # standalone or cluster
clients: 10 # Number of concurrent clients
workload:
type: "exec" # exec, multi, or pub_sub
maxDuration: "60s" # Duration or "endless"
options:
batchSize: 50
getSetRatio: 0.5
valueSize: 100
iterationCount: null # null for unlimited
delayAfterIteration: "10ms"
transactionSize: 10
global:
rps: 0 # Max requests per second (0 = no limit)
betweenClientsDelay: "0ms" # Delay between client creation
metrics:
enabled: true
appName: "go-hitless"
version: "1.0.0"
runId: "" # Auto-generated if empty
output:
jsonFile: "" # Path for JSON results export (optional)
Redis connection configuration including host, port, authentication, and timeouts.
Test execution configuration including mode, number of clients, and workload definition.
Workload-specific settings including type, duration, and various options.
Global application settings including rate limiting, client delays, and metrics configuration.
Executes individual Redis commands (GET, SET, HGET, HSET)
Executes commands in MULTI/EXEC transactions
Publishes and subscribes to Redis channels
The tool supports two key generation strategies:
random
: Generate random keys within the specified rangesequential
: Generate sequential keys (currently implemented as random)
The keyPattern
field supports %d
placeholder for the generated number.
Several example workloads are provided in the workloads/
directory:
example-workload.yaml
: Basic exec workloadmulti-workload.yaml
: Multi/exec transaction workload with rate limitingpubsub-workload.yaml
: Pub/sub workload that runs endlessly
# Basic exec workload
./hitless-tool workloads/example-workload.yaml
# Multi/exec workload with rate limiting
./hitless-tool workloads/multi-workload.yaml
# Pub/sub workload (runs forever)
./hitless-tool workloads/pubsub-workload.yaml
Metrics can be enabled/disabled and configured through the YAML file:
global:
metrics:
enabled: true # Enable/disable metrics
appName: "my-app" # Application name for metrics
version: "1.0.0" # Version for metrics
runId: "custom" # Custom run ID (auto-generated if empty)
Instead of sending metrics to an OTLP endpoint, you can disable metrics and export test results to a JSON file:
global:
metrics:
enabled: false # Disable metrics export
appName: "my-test-app"
version: "1.0.0"
output:
jsonFile: "test-results.json" # Export results to JSON file
When metrics are disabled and a JSON output file is configured, the tool will export final test results containing:
- Test Duration: Total test execution time with start/end timestamps
- App Name: Application name from configuration
- Workload Name: Type of workload executed (exec, multi, pubsub)
- Total Commands Count: Total number of commands attempted
- Successful Commands: Number of commands that succeeded
- Failed Commands: Number of commands that failed
- Success Rate: Percentage of successful commands
- Overall Throughput: Average commands per second
Example JSON output:
{
"test_duration": "5.04s",
"start_timestamp": "2025-07-22T10:50:02+03:00",
"end_timestamp": "2025-07-22T10:50:07+03:00",
"app_name": "redis-test-app",
"workload_name": "exec",
"total_commands_count": 604,
"successful_commands": 604,
"failed_commands": 0,
"success_rate": 100,
"overall_throughput": 119.78
}
The results are exported both to the specified JSON file and printed to stdout for easy viewing.
All duration and delay values use Go's duration format:
"1s"
- 1 second"500ms"
- 500 milliseconds"1m"
- 1 minute"1h"
- 1 hour"endless"
- Run forever (only for maxDuration)