The loadtest executable connects to a witness and determines how many updates it can handle before it is unable to maintain a given latency. It acts as a set of deterministic, in-memory logs that send update requests to the witness.
How it Works
The load test escalates its request rate (QPS) until witness updates take longer than a specified deadline (-timeout), or a success criteria of updates/sec is reached (-success_qps).
The load test creates deterministic logs with consistent keys and values. On initialization, it queries the witness to set its internal log sizes to the last witnessed sizes. This allows multiple runs without needing to clear the witness state between tests.
Order of Operations for Running the Test
To run a load test, you must ensure the witness is configured to trust the keys generated by the loadtest tool. Follow these steps:
1. Generate the Logs Configuration
Run the loadtest tool without a target. It will generate the cryptographic keys for the simulated logs and output the required YAML configuration. You can redirect this output to a file:
go run ./cmd/loadtest/ --log_count=50 > /tmp/logs.yaml
2. Update the Witness Configuration
Use the generated file to configure your witness deployment.
For the omniwitness, this file can be provided directly via the --additional_logs flag (see the Example section below).
3. Start the Witness Service
Start your witness instance, ensuring it is using the updated configuration from Step 2.
4. Run the Load Test
Execute the loadtest tool pointing at your running witness:
go run ./cmd/loadtest/ --target=http://localhost:8080 --log_count=50
Configuration Flags
| Flag |
Default |
Description |
-target |
"" |
Base URL of the witness to load test. |
-log_count |
50 |
The number of logs to simulate. |
-num_extra_sigs |
0 |
Number of additional signatures to attach to checkpoints (tests parsing overhead). |
-timeout |
1s |
Maximum latency threshold. If the witness takes longer, the test terminates. |
-start_qps |
5 |
Starting Queries Per Second. |
-max_qps |
0 |
Maximum QPS cap (0 = no maximum). |
-success_qps |
32000 |
Target QPS to reach before exiting successfully. |
-ignore_pushback |
false |
Whether to ignore 429 Too Many Requests responses from the witness. |
Example Usage on Omniwitness
# Generate log keys and configuration
go run ./cmd/loadtest/ --log_count=50 > /tmp/logs.yaml
# Run the omniwitness with the generated config. This leaves the process running in the background!
go run ./cmd/omniwitness \
-v=1 \
--alsologtostderr \
--private_key=PRIVATE+KEY+HammerMe+4447e4a4+AZjU0/B7AorRLJHVqRaWaWExHbRQKWgUDb8Bf9NEpee7 \
--additional_logs=/tmp/logs.yaml \
--poll_interval=0 \
--db_file=/tmp/hammerwit.db &
# Run the load test against the witness
go run ./cmd/loadtest/ \
--target=http://localhost:8080 \
--log_count=50 \
--timeout=5s