xref: /aosp_15_r20/external/aws-sdk-java-v2/test/s3-benchmarks/README.md (revision 8a52c7834d808308836a99fc2a6e0ed8db339086)
1*8a52c783SCole Faust# S3 Benchmark Harness
2*8a52c783SCole Faust
3*8a52c783SCole FaustThis module contains performance tests for `S3AsyncClient` and
4*8a52c783SCole Faust`S3TransferManager`
5*8a52c783SCole Faust
6*8a52c783SCole Faust## How to run
7*8a52c783SCole Faust
8*8a52c783SCole Faust```
9*8a52c783SCole Faust# Build the JAR
10*8a52c783SCole Faustmvn clean install -pl :s3-benchmarks -P quick --am
11*8a52c783SCole Faust
12*8a52c783SCole Faust# download
13*8a52c783SCole Faustjava -jar s3-benchmarks.jar --bucket=bucket --key=key -file=/path/to/destionfile/ --operation=download --partSizeInMB=20 --maxThroughput=100.0
14*8a52c783SCole Faust
15*8a52c783SCole Faust# upload
16*8a52c783SCole Faustjava -jar s3-benchmarks.jar --bucket=bucket --key=key -file=/path/to/sourcefile/ --operation=upload --partSizeInMB=20 --maxThroughput=100.0
17*8a52c783SCole Faust```
18*8a52c783SCole Faust
19*8a52c783SCole Faust## How to run S3Express (temporary)
20*8a52c783SCole FaustThis benchmark is currently separate. Until it's integrated with the other benchmark runner, the usage is as follows:
21*8a52c783SCole Faust```
22*8a52c783SCole Faustmvn exec:exec -Dexec.executable="java" -Dexec.args="-cp %classpath software.amazon.awssdk.s3benchmarks.s3express.S3BenchmarkRunner"
23*8a52c783SCole Faust```
24*8a52c783SCole Faust
25*8a52c783SCole Faust## Command line arguments
26*8a52c783SCole Faust
27*8a52c783SCole Faust### Benchmark version
28*8a52c783SCole Faust
29*8a52c783SCole FaustThe `--version` command line option is used to determine which component is under test:
30*8a52c783SCole Faust
31*8a52c783SCole Faust- `--version=crt` : Indicate to run the benchmark for the CRT's S3Client
32*8a52c783SCole Faust- `--version=java` : Indicate to run the benchmark for the java based S3 Async Client (`MultipartS3AsyncClient` class)
33*8a52c783SCole Faust- `--version=v2`: SDK v2 transfer manager (using `S3CrtAsyncClient` to delegate requests)
34*8a52c783SCole Faust- `--version=v1`: SDK v1 transfer manager (using `AmazonS3Client` to delegate requests)
35*8a52c783SCole Faust
36*8a52c783SCole Faust### Operation
37*8a52c783SCole Faust
38*8a52c783SCole FaustThe `--operation` command line argument determine which transfer operation is used
39*8a52c783SCole Faust
40*8a52c783SCole Faust|operation|supported version|
41*8a52c783SCole Faust|---|-------|
42*8a52c783SCole Faust|download | v1 v2 java crt |
43*8a52c783SCole Faust|upload | v1 v2 java crt |
44*8a52c783SCole Faust|download_directory | v1 v2 |
45*8a52c783SCole Faust|upload_directory | v1 v2 |
46*8a52c783SCole Faust|copy | v1 v2 java |
47*8a52c783SCole Faust
48*8a52c783SCole Faust> All command line argument can be found in the `BenchmarkRunner` class.
49*8a52c783SCole Faust
50*8a52c783SCole Faust# Benchmark scripts Automation
51*8a52c783SCole FaustFrom the `.script` folder, use one of the `benchamrk` scripts to run a test suite.
52*8a52c783SCole Faust
53*8a52c783SCole Faust## single file benchmark
54*8a52c783SCole Faust### usage
55*8a52c783SCole Faust```
56*8a52c783SCole Faustbenchmark download|upload fs|tmpfs|no-op [<size>]
57*8a52c783SCole Faust```
58*8a52c783SCole FaustThe scripts require the operation
59*8a52c783SCole Faust(download or upload) and the location of the type of file system.
60*8a52c783SCole Faust- operation: `download|upload`
61*8a52c783SCole Faust- file system: `fs|tmpfs`
62*8a52c783SCole Faust    - `fs`: regular file system, under the root (`/`) directory
63*8a52c783SCole Faust    - `tmpfs`: in-memory file system (under the `/dev/shm` directory)
64*8a52c783SCole Faust- size (opt): if specified, will only run the test with the specified size (file must exist)
65*8a52c783SCole Faust
66*8a52c783SCole FaustThe Benchmark suite will run the specified operation with different file sizes (1b 8MB+1 8MB-1 128MB 4GB 30GB, if no
67*8a52c783SCole Faustsize are specified) and with
68*8a52c783SCole Faustthe different client (v1 TM, v2 TM and CRT S3 client) and save the result for each benchmark under
69*8a52c783SCole Faust`result/$operation_$location_$name_$version_$size".txt` ie: `result/download_tmpfs_TMv2_128MB.txt`.
70*8a52c783SCole FaustFor upload benchjmarks, the files
71*8a52c783SCole Faust`1b 8MB+1 8MB-1 128MB 4GB 30GB` must all exists under `/` for `fs` or `/dev/shm/` for `tmpfs`. The `create_benchmak_file`
72*8a52c783SCole Faustscript can be used to create them.
73*8a52c783SCole Faust
74*8a52c783SCole Faust## copy benchmark
75*8a52c783SCole Faust```
76*8a52c783SCole Faustbenchmark-copy [<size>]
77*8a52c783SCole Faust```
78*8a52c783SCole FaustFiles `1b 8MB+1 8MB-1 128MB 4GB 30GB`, or the one passed as an argument, need to exist in the s3 bucket.
79*8a52c783SCole Faust
80*8a52c783SCole Faust## directory benchmark
81*8a52c783SCole Faust```
82*8a52c783SCole Faustbenchmark-dir download|upload fs|tmpfs [1B|4K|16M|5G]
83*8a52c783SCole Faust```
84*8a52c783SCole Faust- `fs` is located ia `~/tm_dire_file`
85*8a52c783SCole Faust- `tmpfs` is located at `/dev/shm/tm_dir_file`
86*8a52c783SCole Faust
87*8a52c783SCole Faust# Graph scripts
88*8a52c783SCole FaustThe `ploy.py` creates _Box and Whiskers_ type bar graphs of the test data. **The data is hard coped in the script file.**
89*8a52c783SCole Faust
90*8a52c783SCole Faustdependencies: [plotly](https://plotly.com/python/getting-started/)
91*8a52c783SCole Faust```bash
92*8a52c783SCole Faustpip install plotly
93*8a52c783SCole Faust```
94*8a52c783SCole Faust
95*8a52c783SCole Faustcreating static images also requires Kaleido ([more info](https://plotly.com/python/static-image-export/))
96*8a52c783SCole Faust
97*8a52c783SCole Faust```bash
98*8a52c783SCole Faustpip install kaleido
99*8a52c783SCole Faust```
100*8a52c783SCole Faust
101*8a52c783SCole Faustthen simply run the `plot.py` script to generate images in `../images` (will be created if it does not exist)
102*8a52c783SCole Faust
103*8a52c783SCole Faust```bash
104*8a52c783SCole Faustpython plot.py
105*8a52c783SCole Faust```