chore(storage): add storage benchmark tool for Gaxios refactor comparison#8341
chore(storage): add storage benchmark tool for Gaxios refactor comparison#8341thiyaguk09 wants to merge 66 commits into
Conversation
…sport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18
…otprint against baseline versions
…sport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18
…4856049-gaxios-benchmark
…4856049-gaxios-benchmark
There was a problem hiding this comment.
Code Review
This pull request introduces a new benchmarking tool in handwritten/storage/internal-tooling/benchmark.ts along with updated documentation in the README. The tool enables comparative latency and memory benchmarking between the current codebase and a specified baseline NPM version of @google-cloud/storage. Feedback focuses on improving the robustness of dynamic imports for module compatibility, replacing hardcoded values with constants, enhancing type safety by avoiding any[], and refining the throughput calculation logic.
…xible module resolution
| logMemory('After Metadata'); | ||
|
|
||
| // Scenario 3: Download Small File | ||
| console.log('Starting Scenario 3: Download (1KB)...'); |
There was a problem hiding this comment.
Is there a reason for only choosing only 1KB file size? Can we make this parameterized for other file sizes as well ?
There was a problem hiding this comment.
Are there other operations which are affected by the migration ?
Some possible examples: Large file transfers, Resumable uploads. If yes we should be benchmarking them as well to make sure we do not see any regression in them due to the migration
There was a problem hiding this comment.
Is there a reason for only choosing only 1KB file size? Can we make this parameterized for other file sizes as well ?
Introduced the --fileSize option (defaulting to 1024 bytes) in yargs. The file size buffer is now allocated dynamically (Buffer.alloc(argv.fileSize, 'a')), and throughput calculations adapt to the configured file size.
There was a problem hiding this comment.
Are there other operations which are affected by the migration ? Some possible examples: Large file transfers, Resumable uploads. If yes we should be benchmarking them as well to make sure we do not see any regression in them due to the migration
Agreed! Our resumable uploads currently only support/rely on Gaxios, so testing this path is crucial. To support better benchmarking here, I've added a --resumable boolean flag option. Under the hood, runUploadScenario passes this flag to the storage iterFile.save(content, { resumable: argv.resumable }) option, enabling targeted performance testing of resumable uploads.
There was a problem hiding this comment.
What other operations have been impacted by the migration ? Can you extend the benchmarking script to have them as well.
There was a problem hiding this comment.
Hi @Dhriti07,
I have extended the benchmark.ts script to include Stream Uploads (createWriteStream), Stream Downloads (createReadStream), and List Files (getFiles) alongside the existing standard upload/download and metadata scenarios.
These additions ensure we thoroughly validate the Gaxios transport layer for regressions across all core operations.
…sport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18
eacb087 to
0c58a9a
Compare
…4856049-gaxios-benchmark
…4856049-gaxios-benchmark
…d resumable uploads while updating transport retry defaults
…sport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18
0c58a9a to
fe44861
Compare
…4856049-gaxios-benchmark
…sport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18
2d55123 to
7d5c5ac
Compare
…4856049-gaxios-benchmark
…sport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18
7d5c5ac to
2c0e9c8
Compare
…4856049-gaxios-benchmark
…sport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18
2c0e9c8 to
696a337
Compare
…4856049-gaxios-benchmark
…sport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18
696a337 to
fe055f7
Compare
…sport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18
* fix(storage): standardize URL formatting and enhance transport retry * fix storage transport & retry issues * fix * Update handwritten/storage/src/file.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix(storage): interceptors test * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * feat: implement robust storage conformance test retry framework with request interception and test bench integration * fix: correct response handler for binary/resumable uploads and improve etag check - Updated `responseHandler` to correctly handle different payload types: - Plain objects are mutated with `.headers` and `.status` and returned. - Binary payloads (Buffer/Stream) return raw data to prevent dangerous mutations. - Primitives (e.g., empty strings) return the full `GaxiosResponse` wrapper to preserve access to headers like `Location` for resumable upload initiation. - Fixed `hasPrecondition` logic to safely parse stringified JSON or inspect objects directly for an `etag` property. This prevents false positives on raw text payloads containing the word "etag" and false negatives on object payloads. * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * refactor(storage): replace constructor-based type checks with structural checks and decouple retry logic into idempotent and transient error utilities. * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * refactor(storage): update storage-transport to return full GaxiosResponse and align downstream resource methods * fix: update file request URL construction to support custom protocol endpoints * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * refactor(storage): introduce ENCRYPTION_ALGORITHM_AES256 constant to replace hardcoded strings in File class * fix(storage): merge request headers correctly in file.ts and add missing linting suppressions to ServiceObject * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * test: add bytes method to mock Gaxios responses in storage tests * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * test: add bytes method to mock Gaxios response in acl and headers tests * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * test: add bytes method to mock Gaxios response in acl and headers tests * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * test: add bytes method to mock Gaxios response in acl and headers tests * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * test: add bytes method to mock Gaxios response in acl and headers tests * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * fix(storage): standardize URL formatting and enhance transport retry * refactor(storage): remove Service.ts and migrate logic to StorageTransport (googleapis#8283) - Remove Service.ts and common.ts files from handwritten/storage - Migrate remaining functionality to StorageTransport - chore(ci): upgrade conformance tests to Node 18 * refactor: improve type safety and validation logic in isBucket helper function --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
ff2fd51 to
d4ee55c
Compare
…4856049-gaxios-benchmark
9271939 to
1819fe4
Compare
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕