google-cloud-cpp icon indicating copy to clipboard operation
google-cloud-cpp copied to clipboard

feat(storage): implement multi stream manager for async downloads

Open shubham-up-47 opened this issue 1 month ago • 3 comments

This PR implements scalable multi-stream reading for Zonal Buckets by introducing a MultiStreamManager to pool and reuse gRPC connections. It mitigates performance regressions from frequent stream creation by reusing idle streams and load-balancing requests, while maintaining a proactive background connection to minimize latency during ramp-up.

shubham-up-47 avatar Dec 10 '25 10:12 shubham-up-47

Summary of Changes

Hello @shubham-up-47, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the asynchronous object download capabilities of the Google Cloud Storage C++ client. It introduces a dedicated MultiStreamManager to efficiently handle multiple concurrent read streams, centralizing their lifecycle, reuse, and proactive creation. This refactoring of ObjectDescriptorImpl aims to improve performance and resource utilization for large object downloads by maintaining a dynamic pool of ready streams and intelligently managing their allocation.

Highlights

  • New MultiStreamManager: Introduced a new generic MultiStreamManager template class to centralize the logic for managing multiple asynchronous streams, including their creation, reuse, and lifecycle.
  • ObjectDescriptorImpl Refactoring: The ObjectDescriptorImpl has been significantly refactored to integrate and utilize the new MultiStreamManager, replacing its previous manual stream management with a more robust and scalable approach for handling concurrent read operations.
  • Proactive Stream Creation and Reuse: The system now proactively creates new streams in the background to ensure a ready pool for continuous large object reads. Additionally, idle streams are intelligently identified and moved to the back of a queue for reuse, optimizing resource utilization.
  • Multi-Stream Logic Activation: Previously commented-out code in object_descriptor.cc responsible for triggering subsequent stream creation when read limits are exceeded has been uncommented and activated, enabling the multi-stream behavior.
  • Comprehensive Test Coverage: New unit tests have been added for the MultiStreamManager itself, and existing tests for ObjectDescriptorImpl have been updated and expanded to thoroughly validate the new multi-stream integration and behavior.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot] avatar Dec 10 '25 10:12 gemini-code-assist[bot]

Codecov Report

:x: Patch coverage is 98.53918% with 11 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 92.96%. Comparing base (d6aff23) to head (e73e1bc). :warning: Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
...rage/internal/async/object_descriptor_impl_test.cc 97.74% 9 Missing :warning:
...d/storage/internal/async/object_descriptor_impl.cc 98.33% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15823      +/-   ##
==========================================
+ Coverage   92.95%   92.96%   +0.01%     
==========================================
  Files        2458     2460       +2     
  Lines      227589   228203     +614     
==========================================
+ Hits       211553   212153     +600     
- Misses      16036    16050      +14     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Dec 11 '25 10:12 codecov[bot]

/gcbrun

shubham-up-47 avatar Dec 12 '25 11:12 shubham-up-47