Skip to content
Merged
Show file tree
Hide file tree
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 Dec 3, 2025
c797586
Merge branch 'main' of github.com:googleapis/python-storage into bench
chandra-siri Dec 23, 2025
20d2d2d
add test_reads.py for microbenchmarking reads
chandra-siri Dec 27, 2025
f493bd8
push local files
chandra-siri Dec 27, 2025
68c8ba0
1p 1c working copy
chandra-siri Dec 28, 2025
9e2afa8
Add microbenchmarking tests and utility functions for performance ana…
chandra-siri Dec 28, 2025
3ffc98d
Update microbenchmark configuration and tests for improved performanc…
chandra-siri Dec 28, 2025
bef9dcb
upload local changes
chandra-siri Dec 29, 2025
75007a7
just upload one
chandra-siri Dec 30, 2025
a85fff1
Refactor get_persisted_size_async to improve logging and update get_p…
chandra-siri Dec 31, 2025
4c24f66
working copy
chandra-siri Jan 2, 2026
e216644
add regional tests
chandra-siri Jan 3, 2026
80120a1
Add JSON to CSV conversion script and update benchmark tests for mult…
chandra-siri Jan 3, 2026
99bc3eb
Refactor benchmark configuration and cleanup unused code in test_read…
chandra-siri Jan 3, 2026
f4a622b
Merge branch 'main' of github.com:googleapis/python-storage into bench
chandra-siri Jan 3, 2026
af98e0e
Implement write benchmarks
chandra-siri Jan 3, 2026
1405e92
Merge branch 'main' of github.com:googleapis/python-storage into bench
chandra-siri Jan 4, 2026
3c7e7af
Merge branch 'bench' of github.com:googleapis/python-storage into bench
chandra-siri Jan 4, 2026
970b162
working copy
chandra-siri Jan 8, 2026
0bf17c7
Add benchmarks for downloading and uploading large objects, and impro…
chandra-siri Jan 11, 2026
a7309ac
revert changes in `samples/snippets/storage_list_files_with_prefix.py`
chandra-siri Jan 11, 2026
829f0f4
Remove unused test utility file in asyncio tests
chandra-siri Jan 11, 2026
72e98d6
Remove deprecated benchmark scripts for downloading and uploading obj…
chandra-siri Jan 11, 2026
5586aa6
Remove crc32 benchmark script
chandra-siri Jan 11, 2026
e3797e4
add 'read_rand_multi_coros' in `test_downloads_single_proc_multi_coro`
chandra-siri Jan 11, 2026
6bf72a0
Addressed gemini comments
chandra-siri Jan 11, 2026
9d571a1
fix kokoro lint failures: Refactor print statements in benchmark util…
chandra-siri Jan 11, 2026
b03f712
Add license headers to microbenchmark test files
chandra-siri Jan 11, 2026
6fab6ea
move json_to_csv inside benchmarks folder
chandra-siri Jan 11, 2026
b5d26c5
Merge branch 'main' into bench
chandra-siri Jan 12, 2026
9873084
move reads & writes into their folders
chandra-siri Jan 15, 2026
6d88a15
Add writes benchmarking
chandra-siri Jan 15, 2026
3e5435e
move writes benchmarking into another PR
chandra-siri Jan 15, 2026
7dd5e00
Merge branch 'main' into bench
chandra-siri Jan 15, 2026
3c0dac2
refactor: reorganize benchmark parameters add each parameter.py in re…
chandra-siri Jan 15, 2026
016dfbe
Merge branch 'bench' of github.com:googleapis/python-storage into ben…
chandra-siri Jan 15, 2026
3f76aab
fix: update config file path in write parameters and adjust import st…
chandra-siri Jan 15, 2026
11ff2f6
move writes into another PR
chandra-siri Jan 15, 2026
4a94ed6
remove write related changes from contest.py
chandra-siri Jan 15, 2026
17fc801
fix: correct import path for WriteParameters in config.py
chandra-siri Jan 15, 2026
0a9d185
fix: update bucket_map to use environment variables for default bucke…
chandra-siri Jan 15, 2026
1298818
fix: update bucket map to use environment variables for default values
chandra-siri Jan 15, 2026
ffc7cd1
Apply suggestion from @gemini-code-assist[bot]
chandra-siri Jan 15, 2026
799bc99
refactor: simplify throughput calculations and improve function docum…
chandra-siri Jan 15, 2026
a20622c
refactor: enhance docstrings for clarity and detail in read benchmarks
chandra-siri Jan 15, 2026
91553d8
add README for performance microbenchmarks with usage instructions
chandra-siri Jan 15, 2026
a283c89
add testing dependencies for benchmarking
chandra-siri Jan 15, 2026
3f0b1c2
Merge branch 'bench' of github.com:googleapis/python-storage into ben…
chandra-siri Jan 15, 2026
7c7808e
update README and test_writes.py with detailed usage examples and enh…
chandra-siri Jan 15, 2026
0066029
refactor: simplify num_files calculation and clean up imports in writ…
chandra-siri Jan 15, 2026
042c60b
refactor: enhance docstring for get_write_params function to clarify …
chandra-siri Jan 15, 2026
39cd8fb
Merge branch 'main' of github.com:googleapis/python-storage into benc…
chandra-siri Jan 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/perf/microbenchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ pytest --benchmark-json=output.json -vv -s tests/perf/microbenchmarks/reads/test

To run a single test, append `::` followed by the test name to the file path.

Example:
Examples:
```bash
pytest --benchmark-json=output.json -vv -s tests/perf/microbenchmarks/reads/test_reads.py::test_downloads_single_proc_single_coro
```
```bash
pytest --benchmark-json=output.json -vv -s tests/perf/microbenchmarks/writes/test_writes.py::test_uploads_single_proc_single_coro
```

## Configuration

Expand Down
19 changes: 13 additions & 6 deletions tests/perf/microbenchmarks/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
AsyncAppendableObjectWriter,
)
from google.cloud.storage._experimental.asyncio.async_grpc_client import AsyncGrpcClient
from tests.perf.microbenchmarks.writes.parameters import WriteParameters

_OBJECT_NAME_PREFIX = "micro-benchmark"

Expand Down Expand Up @@ -135,10 +136,16 @@ def _create_files(num_files, bucket_name, bucket_type, object_size, chunk_size=1
@pytest.fixture
def workload_params(request):
params = request.param
files_names = _create_files(
params.num_files,
params.bucket_name,
params.bucket_type,
params.file_size_bytes,
)
if isinstance(params, WriteParameters):
files_names = [
f"{_OBJECT_NAME_PREFIX}-{uuid.uuid4().hex[:5]}"
for _ in range(params.num_files)
]
else:
files_names = _create_files(
params.num_files,
params.bucket_name,
params.bucket_type,
params.file_size_bytes,
)
return params, files_names
Empty file.
100 changes: 100 additions & 0 deletions tests/perf/microbenchmarks/writes/config.py
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
34 changes: 34 additions & 0 deletions tests/perf/microbenchmarks/writes/config.yaml
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"
20 changes: 20 additions & 0 deletions tests/perf/microbenchmarks/writes/parameters.py
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
Loading