Skip to content

Commit b96e088

Browse files
committed
Add CLI flags to run-benchmark.sh and rename *_TASKSET to *_CPUSET
1 parent 46faf55 commit b96e088

2 files changed

Lines changed: 190 additions & 190 deletions

File tree

benchmark-runner/README.md

Lines changed: 50 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -49,46 +49,45 @@ The `run-benchmark.sh` script will automatically build the JAR if missing.
4949

5050
## Configuration
5151

52-
All configuration is via environment variables:
52+
Configuration via CLI flags (preferred) or environment variables (fallback). CLI flags take precedence.
53+
54+
Run `./run-benchmark.sh --help` for the full list.
55+
56+
### Server
57+
| CLI flag | Env var | Default | Description |
58+
|----------|---------|---------|-------------|
59+
| `--mode` | `SERVER_MODE` | NON_VIRTUAL_NETTY | Mode: NON_VIRTUAL_NETTY, REACTIVE, VIRTUAL_NETTY, NETTY_SCHEDULER |
60+
| `--threads` | `SERVER_THREADS` | 2 | Number of event loop threads |
61+
| `--mockless` | `SERVER_MOCKLESS` | false | Skip mock server; do Jackson work inline |
62+
| `--io` | `SERVER_IO` | epoll | I/O type: epoll, nio, io_uring |
63+
| `--poller-mode` | `SERVER_POLLER_MODE` | | jdk.pollerMode: 1, 2, or 3 |
64+
| `--fj-parallelism` | `SERVER_FJ_PARALLELISM` | | ForkJoinPool parallelism |
65+
| `--fj-affinity` | `SERVER_FJ_AFFINITY` | false | FJ scheduler affinity |
66+
| `--server-cpuset` | `SERVER_CPUSET` | 2,3 | CPU pinning |
67+
| `--jvm-args` | `SERVER_JVM_ARGS` | | Additional JVM arguments |
5368

5469
### Mock Server
55-
| Variable | Default | Description |
56-
|----------|---------|-------------|
57-
| `MOCK_PORT` | 8080 | Mock server port |
58-
| `MOCK_THINK_TIME_MS` | 1 | Simulated processing delay (ms) |
59-
| `MOCK_THREADS` | auto | Number of Netty threads (empty = available processors) |
60-
| `MOCK_TASKSET` | 4,5,6,7 | CPU affinity (e.g., "0-1") |
61-
62-
### Handoff Server
63-
| Variable | Default | Description |
64-
|----------|---------|-------------|
65-
| `SERVER_PORT` | 8081 | Server port |
66-
| `SERVER_THREADS` | 2 | Number of event loop threads |
67-
| `SERVER_REACTIVE` | false | Use reactive handler with Reactor |
68-
| `SERVER_USE_CUSTOM_SCHEDULER` | false | Use custom Netty scheduler |
69-
| `SERVER_IO` | epoll | I/O type: epoll, nio, or io_uring |
70-
| `SERVER_NO_TIMEOUT` | false | Disable HTTP client timeout |
71-
| `SERVER_TASKSET` | 2,3 | CPU affinity (e.g., "2-5") |
72-
| `SERVER_JVM_ARGS` | | Additional JVM arguments |
73-
| `SERVER_POLLER_MODE` | 3 | jdk.pollerMode value: 1, 2, or 3 |
74-
| `SERVER_FJ_PARALLELISM` | | ForkJoinPool parallelism (empty = JVM default) |
70+
| CLI flag | Env var | Default | Description |
71+
|----------|---------|---------|-------------|
72+
| `--mock-port` | `MOCK_PORT` | 8080 | Mock server port |
73+
| `--mock-think-time` | `MOCK_THINK_TIME_MS` | 1 | Simulated processing delay (ms) |
74+
| `--mock-threads` | `MOCK_THREADS` | 1 | Number of Netty threads |
75+
| `--mock-cpuset` | `MOCK_CPUSET` | 4,5 | CPU pinning |
7576

7677
### Load Generator
77-
| Variable | Default | Description |
78-
|----------|---------|-------------|
79-
| `LOAD_GEN_CONNECTIONS` | 100 | Number of connections |
80-
| `LOAD_GEN_THREADS` | 2 | Number of threads |
81-
| `LOAD_GEN_RATE` | | Target rate (empty = max throughput with wrk) |
82-
| `LOAD_GEN_TASKSET` | 0,1 | CPU affinity (e.g., "6-7") |
83-
| `LOAD_GEN_URL` | http://localhost:8081/fruits | Target URL |
78+
| CLI flag | Env var | Default | Description |
79+
|----------|---------|---------|-------------|
80+
| `--connections` | `LOAD_GEN_CONNECTIONS` | 100 | Number of connections |
81+
| `--load-threads` | `LOAD_GEN_THREADS` | 2 | Number of threads |
82+
| `--duration` | `LOAD_GEN_DURATION` | 30s | Test duration |
83+
| `--rate` | `LOAD_GEN_RATE` | | Target rate for wrk2 (omit for max throughput) |
84+
| `--load-cpuset` | `LOAD_GEN_CPUSET` | 0,1 | CPU pinning |
8485

8586
### Timing
86-
| Variable | Default | Description |
87-
|----------|---------|-------------|
88-
| `WARMUP_DURATION` | 10s | Warmup duration (no profiling) |
89-
| `TOTAL_DURATION` | 30s | Total test duration (steady-state must be >= 20s) |
90-
| `PROFILING_DELAY_SECONDS` | 5 | Delay before starting profiling/perf/JFR |
91-
| `PROFILING_DURATION_SECONDS` | 10 | Profiling/perf/JFR duration in seconds |
87+
| CLI flag | Env var | Default | Description |
88+
|----------|---------|---------|-------------|
89+
| `--warmup` | `WARMUP_DURATION` | 10s | Warmup duration |
90+
| `--total-duration` | `TOTAL_DURATION` | 30s | Total test duration (steady-state >= 20s) |
9291

9392
### Profiling
9493
| Variable | Default | Description |
@@ -153,73 +152,47 @@ perf stat uses `PROFILING_DELAY_SECONDS` and `PROFILING_DURATION_SECONDS`.
153152

154153
## Example Runs
155154

156-
### Basic comparison: custom vs default scheduler
155+
### Basic comparison: modes
157156

158157
```bash
159-
# With custom scheduler
160-
JAVA_HOME=/path/to/jdk \
161-
SERVER_USE_CUSTOM_SCHEDULER=true \
162-
./run-benchmark.sh
158+
# Custom scheduler mode
159+
./run-benchmark.sh --mode netty_scheduler
163160

164-
# With default scheduler
165-
JAVA_HOME=/path/to/jdk \
166-
SERVER_USE_CUSTOM_SCHEDULER=false \
167-
./run-benchmark.sh
161+
# Virtual Netty mode, mockless
162+
./run-benchmark.sh --mode virtual_netty --threads 2 --mockless
168163
```
169164

170165
### With CPU pinning
171166

172167
```bash
173-
JAVA_HOME=/path/to/jdk \
174-
MOCK_TASKSET="0" \
175-
SERVER_TASKSET="1-4" \
176-
LOAD_GEN_TASKSET="5-7" \
177-
SERVER_THREADS=4 \
178-
SERVER_USE_CUSTOM_SCHEDULER=true \
179-
./run-benchmark.sh
168+
./run-benchmark.sh --mode netty_scheduler --threads 4 \
169+
--server-cpuset 1-4 --mock-cpuset 0 --load-cpuset 5-7
180170
```
181171

182172
### With profiling
183173

184174
```bash
185-
JAVA_HOME=/path/to/jdk \
186-
ENABLE_PROFILER=true \
187-
ASYNC_PROFILER_PATH=/path/to/async-profiler \
188-
PROFILER_EVENT=cpu \
189-
SERVER_USE_CUSTOM_SCHEDULER=true \
190-
WARMUP_DURATION=15s \
191-
TOTAL_DURATION=45s \
192-
./run-benchmark.sh
175+
./run-benchmark.sh --mode netty_scheduler \
176+
--profiler --profiler-path /path/to/async-profiler \
177+
--warmup 15s --total-duration 45s
193178
```
194179

195180
### With JFR events enabled (subset)
196181

197182
```bash
198-
JAVA_HOME=/path/to/jdk \
199-
ENABLE_JFR=true \
200-
JFR_EVENTS=NettyRunIo,VirtualThreadTaskRuns \
201-
SERVER_USE_CUSTOM_SCHEDULER=true \
202-
./run-benchmark.sh
183+
./run-benchmark.sh --mode netty_scheduler --jfr --jfr-events NettyRunIo,VirtualThreadTaskRuns
203184
```
204185

205186
### Rate-limited test with wrk2
206187

207188
```bash
208-
JAVA_HOME=/path/to/jdk \
209-
LOAD_GEN_RATE=10000 \
210-
LOAD_GEN_CONNECTIONS=200 \
211-
TOTAL_DURATION=60s \
212-
WARMUP_DURATION=15s \
213-
./run-benchmark.sh
189+
./run-benchmark.sh --rate 10000 --connections 200 --total-duration 60s --warmup 15s
214190
```
215191

216-
### With pidstat monitoring
192+
### Mixed: CLI flags + env vars
217193

218194
```bash
219-
JAVA_HOME=/path/to/jdk \
220-
ENABLE_PIDSTAT=true \
221-
PIDSTAT_INTERVAL=1 \
222-
./run-benchmark.sh
195+
SERVER_JVM_ARGS="-XX:+PrintGCDetails" ./run-benchmark.sh --mode virtual_netty --threads 2
223196
```
224197

225198
## Output
@@ -260,7 +233,7 @@ java -cp benchmark-runner/target/benchmark-runner.jar \
260233
8080 1 # port, thinkTimeMs (threads defaults to available processors)
261234
```
262235

263-
### Handoff Server (with custom scheduler)
236+
### Handoff Server (custom scheduler mode)
264237

265238
```bash
266239
java \
@@ -275,11 +248,11 @@ java \
275248
--port 8081 \
276249
--mock-url http://localhost:8080/fruits \
277250
--threads 2 \
278-
--use-custom-scheduler true \
251+
--mode netty_scheduler \
279252
--io epoll
280253
```
281254

282-
### Handoff Server (with default scheduler)
255+
### Handoff Server (default split topology)
283256

284257
```bash
285258
java \
@@ -292,6 +265,5 @@ java \
292265
--port 8081 \
293266
--mock-url http://localhost:8080/fruits \
294267
--threads 2 \
295-
--use-custom-scheduler false \
296268
--io epoll
297269
```

0 commit comments

Comments
 (0)