Skip to content

Commit eaa5fdb

Browse files
committed
readme
1 parent 6cccec6 commit eaa5fdb

File tree

1 file changed

+166
-1
lines changed

1 file changed

+166
-1
lines changed

README.md

Lines changed: 166 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,166 @@
1-
# another-redis-benchmark
1+
# Another Redis Benchmark
2+
3+
Another Redis Benchmark is a Go-based application designed for performance testing of Redis instances. It simulates real-world client workloads to measure operations latency and throughput for `SET`, `GET`, and `DEL` commands.
4+
5+
---
6+
7+
## Features
8+
- Simulates realistic Redis workloads with multiple concurrent clients.
9+
- Measures latency for `SET`, `GET`, and `DEL` operations.
10+
- Supports configurable test parameters (e.g., number of clients, key count, test duration).
11+
- Provides detailed statistics, including:
12+
- Total operations.
13+
- Average operations per second.
14+
- Minimum, average, and maximum latency for each operation.
15+
- Cross-platform support (Linux, MacOS, Windows, ARM64, and AMD64).
16+
17+
---
18+
19+
## Getting Started
20+
21+
### Prerequisites
22+
- **Redis**: Ensure you have a Redis instance running and accessible.
23+
- **Go**: Version 1.23 or higher.
24+
25+
---
26+
27+
## Installation
28+
29+
### Build from Source
30+
1. Clone the repository:
31+
```bash
32+
git clone https://github.com/<your-repo>/another-redis-benchmark.git
33+
cd another-redis-benchmark
34+
```
35+
2. Build the binary:
36+
```bash
37+
go build -o another-redis-benchmark
38+
```
39+
40+
### Prebuilt Binaries
41+
You can download prebuilt binaries for your platform from the [Releases](https://github.com/<your-repo>/another-redis-benchmark/releases) page.
42+
43+
---
44+
45+
## Usage
46+
47+
Run the application with customizable parameters.
48+
49+
### Basic Command
50+
```bash
51+
./another-redis-benchmark [options]
52+
```
53+
54+
---
55+
56+
## Command-Line Options
57+
58+
| Option | Default Value | Description |
59+
|---------------------|----------------|--------------------------------------------------------------------------------------|
60+
| `-addr` | `localhost:6379` | Redis server address. |
61+
| `-pass` | `""` | Redis server password. |
62+
| `-db` | `0` | Redis database index. |
63+
| `-clients` | `10` | Number of concurrent clients to simulate. |
64+
| `-keys` | `1000` | Number of unique keys to test. |
65+
| `-prefix` | `benchmark_` | Prefix for generated keys. |
66+
| `-ttl` | `60s` | Time-to-live for `SET` operations. |
67+
| `-duration` | `10s` | Test duration. |
68+
| `-set` | `0.5` | Proportion of `SET` operations (relative to the total workload). |
69+
| `-get` | `0.4` | Proportion of `GET` operations (relative to the total workload). |
70+
| `-del` | `0.1` | Proportion of `DEL` operations (relative to the total workload). |
71+
72+
---
73+
74+
### Examples
75+
76+
#### 1. Run with Default Parameters
77+
```bash
78+
./another-redis-benchmark
79+
```
80+
81+
#### 2. Customize Redis Address and Password
82+
```bash
83+
./another-redis-benchmark -addr "redis.example.com:6379" -pass "my_redis_password"
84+
```
85+
86+
#### 3. Increase Workload and Test Duration
87+
```bash
88+
./another-redis-benchmark -clients 50 -keys 10000 -duration 30s
89+
```
90+
91+
---
92+
93+
## Output
94+
95+
### Real-Time Progress
96+
```
97+
Client 1: SET=123, GET=456, DEL=78
98+
Client 2: SET=234, GET=567, DEL=89
99+
...
100+
Total: SET=357, GET=1023, DEL=167
101+
```
102+
103+
### Final Summary
104+
```
105+
Benchmark complete.
106+
Total clients: 10
107+
Total keys: 1000
108+
Total time: 10s
109+
SET operations: 5000
110+
GET operations: 4000
111+
DEL operations: 1000
112+
Average SET ops/sec: 500.0
113+
Average GET ops/sec: 400.0
114+
Average DEL ops/sec: 100.0
115+
SET Latency (ms): Min=0.50, Avg=1.23, Max=10.45
116+
GET Latency (ms): Min=0.45, Avg=1.10, Max=8.97
117+
DEL Latency (ms): Min=0.60, Avg=1.45, Max=12.34
118+
```
119+
120+
---
121+
122+
## Advanced Configuration
123+
124+
### Key Distribution
125+
- Use the `-keys` parameter to define the number of unique keys.
126+
- Higher values spread operations across more keys, reducing key collisions.
127+
128+
### Custom Workload
129+
- Adjust `-set`, `-get`, and `-del` ratios to simulate specific workloads.
130+
- Example: `-set 0.7 -get 0.2 -del 0.1` focuses on `SET` operations.
131+
132+
---
133+
134+
## Cross-Platform Support
135+
Download the appropriate binary for your platform:
136+
- **Linux**: `another-redis-benchmark-linux-amd64.zip`
137+
- **MacOS**: `another-redis-benchmark-darwin-arm64.zip`
138+
- **Windows**: `another-redis-benchmark-windows-amd64.zip`
139+
140+
Extract the ZIP file and run the executable.
141+
142+
---
143+
144+
## Development
145+
146+
### Running Tests
147+
To test the application:
148+
```bash
149+
go test ./...
150+
```
151+
152+
### Contributing
153+
Feel free to open issues or submit pull requests. Follow the [CONTRIBUTING.md](https://github.com/<your-repo>/another-redis-benchmark/blob/main/CONTRIBUTING.md) for guidelines.
154+
155+
---
156+
157+
## License
158+
This project is licensed under the MIT License. See [LICENSE](https://github.com/<your-repo>/another-redis-benchmark/blob/main/LICENSE) for details.
159+
160+
---
161+
162+
## Known Issues
163+
1. **High Latency on Large Key Sets**:
164+
- Ensure Redis server is properly configured for high throughput.
165+
2. **Limited Resources on Local Machines**:
166+
- Consider testing on a dedicated Redis server for accurate benchmarks.

0 commit comments

Comments
 (0)