-
Notifications
You must be signed in to change notification settings - Fork 169
feat: Add micro-benchmarks for writes comparing standard (regional) vs rapid (zonal) buckets. #1707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
5d58213
local files for benchmarking
chandra-siri c797586
Merge branch 'main' of github.com:googleapis/python-storage into bench
chandra-siri 20d2d2d
add test_reads.py for microbenchmarking reads
chandra-siri f493bd8
push local files
chandra-siri 68c8ba0
1p 1c working copy
chandra-siri 9e2afa8
Add microbenchmarking tests and utility functions for performance ana…
chandra-siri 3ffc98d
Update microbenchmark configuration and tests for improved performanc…
chandra-siri bef9dcb
upload local changes
chandra-siri 75007a7
just upload one
chandra-siri a85fff1
Refactor get_persisted_size_async to improve logging and update get_p…
chandra-siri 4c24f66
working copy
chandra-siri e216644
add regional tests
chandra-siri 80120a1
Add JSON to CSV conversion script and update benchmark tests for mult…
chandra-siri 99bc3eb
Refactor benchmark configuration and cleanup unused code in test_read…
chandra-siri f4a622b
Merge branch 'main' of github.com:googleapis/python-storage into bench
chandra-siri af98e0e
Implement write benchmarks
chandra-siri 1405e92
Merge branch 'main' of github.com:googleapis/python-storage into bench
chandra-siri 3c7e7af
Merge branch 'bench' of github.com:googleapis/python-storage into bench
chandra-siri 970b162
working copy
chandra-siri 0bf17c7
Add benchmarks for downloading and uploading large objects, and impro…
chandra-siri a7309ac
revert changes in `samples/snippets/storage_list_files_with_prefix.py`
chandra-siri 829f0f4
Remove unused test utility file in asyncio tests
chandra-siri 72e98d6
Remove deprecated benchmark scripts for downloading and uploading obj…
chandra-siri 5586aa6
Remove crc32 benchmark script
chandra-siri e3797e4
add 'read_rand_multi_coros' in `test_downloads_single_proc_multi_coro`
chandra-siri 6bf72a0
Addressed gemini comments
chandra-siri 9d571a1
fix kokoro lint failures: Refactor print statements in benchmark util…
chandra-siri b03f712
Add license headers to microbenchmark test files
chandra-siri 6fab6ea
move json_to_csv inside benchmarks folder
chandra-siri b5d26c5
Merge branch 'main' into bench
chandra-siri 9873084
move reads & writes into their folders
chandra-siri 6d88a15
Add writes benchmarking
chandra-siri 3e5435e
move writes benchmarking into another PR
chandra-siri 7dd5e00
Merge branch 'main' into bench
chandra-siri 3c0dac2
refactor: reorganize benchmark parameters add each parameter.py in re…
chandra-siri 016dfbe
Merge branch 'bench' of github.com:googleapis/python-storage into ben…
chandra-siri 3f76aab
fix: update config file path in write parameters and adjust import st…
chandra-siri 11ff2f6
move writes into another PR
chandra-siri 4a94ed6
remove write related changes from contest.py
chandra-siri 17fc801
fix: correct import path for WriteParameters in config.py
chandra-siri 0a9d185
fix: update bucket_map to use environment variables for default bucke…
chandra-siri 1298818
fix: update bucket map to use environment variables for default values
chandra-siri ffc7cd1
Apply suggestion from @gemini-code-assist[bot]
chandra-siri 799bc99
refactor: simplify throughput calculations and improve function docum…
chandra-siri a20622c
refactor: enhance docstrings for clarity and detail in read benchmarks
chandra-siri 91553d8
add README for performance microbenchmarks with usage instructions
chandra-siri a283c89
add testing dependencies for benchmarking
chandra-siri 3f0b1c2
Merge branch 'bench' of github.com:googleapis/python-storage into ben…
chandra-siri 7c7808e
update README and test_writes.py with detailed usage examples and enh…
chandra-siri 0066029
refactor: simplify num_files calculation and clean up imports in writ…
chandra-siri 042c60b
refactor: enhance docstring for get_write_params function to clarify …
chandra-siri 39cd8fb
Merge branch 'main' of github.com:googleapis/python-storage into benc…
chandra-siri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Copyright 2026 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| import itertools | ||
| import os | ||
| from typing import Dict, List | ||
|
|
||
| import yaml | ||
|
|
||
| try: | ||
| from tests.perf.microbenchmarks.writes.parameters import WriteParameters | ||
| except ModuleNotFoundError: | ||
| from parameters import WriteParameters | ||
|
|
||
|
|
||
| def get_write_params() -> Dict[str, List[WriteParameters]]: | ||
| """Generates benchmark parameters from a YAML configuration file. | ||
|
|
||
| This function reads the configuration from `config.yaml`, located in the | ||
| same directory, and generates all possible combinations of write parameters | ||
| based on the defined workloads. It uses `itertools.product` to create | ||
| a Cartesian product of parameters like bucket types, file sizes, etc. | ||
|
|
||
| Returns: | ||
| Dict[str, List[WriteParameters]]: A dictionary where keys are workload | ||
| names and values are lists of `WriteParameters` instances for that | ||
| workload. | ||
| """ | ||
| params: Dict[str, List[WriteParameters]] = {} | ||
| config_path = os.path.join(os.path.dirname(__file__), "config.yaml") | ||
| with open(config_path, "r") as f: | ||
| config = yaml.safe_load(f) | ||
|
|
||
| common_params = config["common"] | ||
| bucket_types = common_params["bucket_types"] | ||
| file_sizes_mib = common_params["file_sizes_mib"] | ||
| chunk_sizes_mib = common_params["chunk_sizes_mib"] | ||
| rounds = common_params["rounds"] | ||
|
|
||
| bucket_map = { | ||
| "zonal": os.environ.get("DEFAULT_RAPID_ZONAL_BUCKET", config['defaults']['DEFAULT_RAPID_ZONAL_BUCKET']), | ||
| "regional": os.environ.get("DEFAULT_STANDARD_BUCKET", config['defaults']['DEFAULT_STANDARD_BUCKET']) | ||
| } | ||
|
|
||
| for workload in config["workload"]: | ||
| workload_name = workload["name"] | ||
| params[workload_name] = [] | ||
| processes = workload["processes"] | ||
| coros = workload["coros"] | ||
|
|
||
| # Create a product of all parameter combinations | ||
| product = itertools.product( | ||
| bucket_types, | ||
| file_sizes_mib, | ||
| chunk_sizes_mib, | ||
| processes, | ||
| coros, | ||
| ) | ||
|
|
||
| for ( | ||
| bucket_type, | ||
| file_size_mib, | ||
| chunk_size_mib, | ||
| num_processes, | ||
| num_coros, | ||
| ) in product: | ||
| file_size_bytes = file_size_mib * 1024 * 1024 | ||
| chunk_size_bytes = chunk_size_mib * 1024 * 1024 | ||
| bucket_name = bucket_map[bucket_type] | ||
|
|
||
| num_files = num_processes * num_coros | ||
|
|
||
| # Create a descriptive name for the parameter set | ||
| name = f"{workload_name}_{bucket_type}_{num_processes}p_{num_coros}c" | ||
|
|
||
| params[workload_name].append( | ||
| WriteParameters( | ||
| name=name, | ||
| workload_name=workload_name, | ||
| bucket_name=bucket_name, | ||
| bucket_type=bucket_type, | ||
| num_coros=num_coros, | ||
| num_processes=num_processes, | ||
| num_files=num_files, | ||
| rounds=rounds, | ||
| chunk_size_bytes=chunk_size_bytes, | ||
| file_size_bytes=file_size_bytes, | ||
| ) | ||
| ) | ||
| return params |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| common: | ||
| bucket_types: | ||
| - "regional" | ||
| - "zonal" | ||
| file_sizes_mib: | ||
| - 1024 # 1GiB | ||
| chunk_sizes_mib: [100] | ||
| rounds: 10 | ||
|
|
||
| workload: | ||
|
|
||
| ############# single proc single coroutines ######### | ||
| - name: "write_seq" | ||
| pattern: "seq" | ||
| coros: [1] | ||
| processes: [1] | ||
|
|
||
| ############# single proc multiple coroutines ######### | ||
|
|
||
| - name: "write_seq_multi_coros" | ||
| pattern: "seq" | ||
| coros: [2, 4, 8, 16] | ||
| processes: [1] | ||
|
|
||
| ############# multiple proc multiple coroutines ######### | ||
| - name: "write_seq_multi_process" | ||
| pattern: "seq" | ||
| coros: [1, 2] | ||
| processes: [8, 16, 32, 64] | ||
|
|
||
|
|
||
| defaults: | ||
| DEFAULT_RAPID_ZONAL_BUCKET: "chandrasiri-benchmarks-zb" | ||
| DEFAULT_STANDARD_BUCKET: "chandrasiri-benchmarks-rb" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Copyright 2026 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| from dataclasses import dataclass | ||
| from ..parameters import IOBenchmarkParameters | ||
|
|
||
|
|
||
| @dataclass | ||
| class WriteParameters(IOBenchmarkParameters): | ||
| pass |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.