feat(perf): add microbenchmark suite for cat_ranges - #1035
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new microbenchmark suite for the cat_ranges operation in gcsfs, including configuration setups, benchmark parameters, and single-threaded test cases. The review feedback highlights several critical improvement opportunities: correcting the sequential range generation logic to prevent backward jumps, adding validation to ensure range sizes do not exceed file sizes, and robustly handling potentially empty or null configuration values for chunk sizes, batch sizes, and maximum gaps to avoid runtime errors.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1035 +/- ##
==========================================
- Coverage 90.10% 90.08% -0.02%
==========================================
Files 16 16
Lines 3679 3683 +4
==========================================
+ Hits 3315 3318 +3
- Misses 364 365 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
69b76f3 to
b6756d6
Compare
Yonghui-Lee
left a comment
There was a problem hiding this comment.
Throughput calculation in run.py is wrong for cat_ranges. For cat_ranges, the actual data transferred is not file_size * files.
…rn, and error raising - Track sequential offsets per file in _generate_ranges to ensure each file experiences contiguous sequential reads when files > 1. - Wrap around to offset 0 instead of terminating early when offset exceeds max_offset, ensuring exactly num_ranges are generated. - Add support for pattern="mixed" in _generate_ranges with valid bounds. - Pass on_error="raise" and inspect return elements in _cat_ranges_op so errors fail fast rather than silently recording misleading latencies. - Clean up outdated cat_ranges documentation and examples in README files. - Update and add comprehensive unit tests in test_configs.py.
- Remove mixed pattern from CatRangesBenchmarkParameters docstring in parameters.py. - Remove mixed pattern handling from _generate_ranges in test_cat_ranges.py. - Update test_configs.py to test supported patterns (seq, rand) and verify mixed raises ValueError.
…g ranges instead of storing in parameters
Done. Updated the throughput calculation logic to use total_bytes. |
Overview
This PR adds a comprehensive microbenchmark suite for
cat_rangesundergcsfs/tests/perf/microbenchmarks/cat_ranges. It benchmarks multi-range read throughput and latency across Regional, Zonal (Rapid), and Hierarchical Namespace (HNS) buckets under various access patterns and parameter combinations.Summary of Changes
Benchmark Suite (
gcsfs/tests/perf/microbenchmarks/cat_ranges/):parameters.py: DefinesCatRangesBenchmarkParameterscapturing range counts, range selection patterns, chunk sizes,max_gap, andbatch_size.configs.py: ImplementsCatRangesConfiguratorto generate test matrices from YAML configurations.configs.yaml: Defines baseline scenarios covering:cat_ranges_seq: Sequential adjacent ranges across a file.cat_ranges_rand: Uniform random ranges across a file.cat_ranges_mixed_sizes: Variable chunk sizes (64 KB, 1 MB, 4 MB, 16 MB) within the same call.cat_ranges_multi_file: Multi-file range requests distributed round-robin across 5 files.cat_ranges_batch_size_sweep: Concurrency sweep evaluating batch sizes 16, 64, and 128.cat_ranges_large_file_large_ranges: Scale scenario requesting 1,000 mixed ranges across a 10 GB file with batch size 64.test_cat_ranges.py: Implementstest_cat_ranges_single_threadedbenchmark runner usingpytest-benchmarkand pre-generated range offsets to avoid measuring setup overhead.Fixtures and Metrics Reporting (
gcsfs/tests/perf/microbenchmarks/conftest.py):gcsfs_benchmark_cat_rangesfixture to manage lifecycle of temporary test files across bucket types.publish_benchmark_extra_infoto recordnum_ranges,max_gap, andbatch_sizein the benchmark report and output CSVs.Test Framework Registration (
gcsfs/tests/conftest.py):cat_rangesinbenchmark_subdirsto ensure test collection when passing--run-benchmarks.Unit Test Coverage (
gcsfs/tests/perf/microbenchmarks/test_configs.py):test_cat_ranges_configuratorunit test.get_cat_ranges_benchmark_cases()intest_validate_actual_yaml_configsto validate YAML integrity in CI.