11# Gateway Stress-Test Tool
22
3+ ## Introduction
4+
35A simple tool to send a configurable number of parallel decryption requests (public or user
46decrypts at the time of writing), at a given frequency and for a specified duration.
57
8+ ## Table of Contents
9+ - [ Introduction] ( #introduction )
10+ - [ Build] ( #build )
11+ - [ Configuration] ( #configuration )
12+ - [ Run] ( #run )
13+ - [ Stress testing] ( #stress-testing )
14+ - [ Benchmarking] ( #benchmarking )
15+ - [ Tracing] ( #tracing )
16+ - [ Bonus: Generating handles via coprocessor stress-test-generator] ( #bonus-generating-handles-via-coprocessor-stress-test-generator )
17+
18+ ## Build
19+
20+ You can build the tool by running the ` cargo build --release ` command in the
21+ ` test-suite/gateway-stress ` directory.
22+
23+ Alternatively, you can run the manual ` gateway-stress-tool-docker-build ` workflow to trigger the
24+ build of the Docker images for the tool.
25+
626## Configuration
727
828To configure the tool, you can use either a configuration file (TOML format) or environment
@@ -13,16 +33,10 @@ along with its associated environment variable.
1333
1434Configuration fields defined via environment variables override those in the configuration file.
1535
16- ## Build
17-
18- You can build the tool by running the ` cargo build --release ` command in the
19- ` test-suite/gateway-stress ` directory.
20-
21- Alternatively, you can run the manual ` gateway-stress-tool-docker-build ` workflow to trigger the
22- build of the Docker images for the tool.
23-
2436## Run
2537
38+ ### Stress testing
39+
2640Once the ` gateway-stress ` binary has been built, you can run the following commands:
2741
2842``` bash
@@ -48,6 +62,28 @@ cargo run -- -c config/config.toml user
4862
4963Note that the ` mixed ` command of the CLI is not implemented yet.
5064
65+ ### Benchmarking
66+
67+ The ` benchmark ` command take a CSV file in input (and the global config file as well).
68+ Each line of this CSV represent a burst of decryption to benchmark, which is composed of:
69+ - The number of parallel requests in the burst (1st column)
70+ - The number of time we must measure this burst (2nd column)
71+ - The type of decryption in the burst (` public ` or ` user ` )
72+
73+ See the [ templates] ( ./templates ) folder for examples.
74+
75+ It will then run the benchmark and stores the results (average and standard deviation of latency
76+ and throughput) for each burst in a CSV file.
77+
78+ ``` bash
79+ # Run a benchmarking session using `templates/small_bench.csv` as input and store the global
80+ # results in `/tmp/bench.csv`
81+ ./gateway-stress -c config/config.toml benchmark -i templates/small_bench.csv -o /tmp/bench.csv
82+
83+ # Same, but also store each burst result in `tmp/full.csv`
84+ ./gateway-stress -c config/config.toml benchmark -i templates/small_bench.csv -o /tmp/bench.csv -r /tmp/full.csv
85+ ```
86+
5187## Tracing
5288
5389This tool aims to output only essential information regarding the status of the test. The main
@@ -67,17 +103,23 @@ RUST_LOG="gateway_stress=debug,alloy=debug" ./gateway-stress -c config/config.to
67103RUST_LOG=" debug" ./gateway-stress -c config/config.toml public
68104```
69105
70- ## Bonus: Generating handles via coprocessor-stress-test-generator
106+ ## Bonus: Generating handles via coprocessor stress-test-generator
107+
108+ To use this tool, you would need already existing handles to decrypt. You could use coprocessor's
109+ ` stress-test-generator ` tool to generate these handles.
71110
72- First clone the repo. Then, look at the ` README.md ` and gather all the environment variable values
73- needed (default values work only for e2e setup).
111+ The tool is located at ` coprocessor/fhevm-engine/stress-test-generator ` in the ` fhevm ` repo.
112+ Then, look at the ` README.md ` and gather all the environment variable values needed (default
113+ values work only for e2e setup).
74114
75115``` bash
76- git checkout simon/chore/fhevm-0.8.3
77116export EVGEN_DB_URL=" TODO"
78117export ACL_CONTRACT_ADDRESS=" TODO"
79118# ...
80119EVGEN_SCENARIO=data/minitest_003_generate_handles_for_decryption.csv make run
81120```
82121
83122This will generate the ` data/handles_for_pub_decryption ` and ` handles_for_usr_decryption ` files.
123+
124+ Make sure that the 6th column of the ` EVGEN_SCENARIO ` file match the ` allowed_contract ` value of
125+ this tool's configuration, and that the 7th column match the wallet address used by the tool.
0 commit comments