Skip to content

Provide a way to stream read/write requests using a single RPC call #72

Description

@aozarov

This topic was also discussed in #61. Current implementation of the streaming API for both reads and writes is done via multiple RPC calls. Writes are done in chucks (resumable-writes) which is good for error handling (save-points) but at a cost of multiple RPC instead of one. Reads are also segmented (via range requests) instead one RPC for the whole content.

Things to consider:

  1. some platforms may have restrictions on RPC requests (e.g. AE 10MB upstream and 32MB downstream, as well as time-to-live restrictions).
  2. Current implementation of the apiary client does not expose the underlying stream and will copy its content to the caller.
  3. Rate of errors and cost-benefit evaluation (if the recommended size per one RPC is small enough it might be that the option of create with content or load all is sufficient).

Activity

  1. changed the title [-]Should we provide a way to stream read/write requests using a single RPC call.[/-] [+]Should we provide a way to stream read/write requests using a single RPC call?[/+] on May 27, 2015
  2. added
    type: questionRequest for information or clarification. Not an issue.
    api: storageIssues related to the Cloud Storage API.
    and removed
    type: questionRequest for information or clarification. Not an issue.
    on May 27, 2015
  3. aozarov commented on May 31, 2016

    @aozarov
    ContributorAuthor

    PR #534 was taking a stub at it for BigQuery. It would be great if we resurrect it when possible and also apply it for Storage.

  4. mziccard commented on Jun 2, 2016

    @mziccard
    Contributor

    I started having a look at this lately. My only concern is how to expose this functionality to users. Now in Storage we have:

    Blob create(BlobInfo blobInfo, byte[] content, BlobTargetOption... options);
    Blob create(BlobInfo blobInfo, InputStream content, BlobWriteOption... options);

    Both method use non-resumable upload.

    As far as I know when resumable upload is used to create a object the RPC call does not return the object metadata in the response body. So methods that use resumable upload would not be able to offer a return type. Should we call such methods write rather than create?

    Also, resumable upload as implemented in #534 needs a SeekableByteChannel to function (in case of failed upload we need to seek latest upload position through the channel) and not an InputStream. Would adding the following two methods look odd to you?

    void write(BlobInfo blobInfo, byte[] content, BlobTargetOption... options);
    void write(BlobInfo blobInfo, SeekableByteChannel content, BlobWriteOption... options);

    /cc @jgeewax for opinions

  5. mziccard commented on Jun 8, 2016

    @mziccard
    Contributor

    @Capstan Is there a way to make resumable upload return the information on the blob just created (as it happens for direct upload)? Just to be sure I am not missing something here.

    If not, would it be possible in your opinion to have the "closing" call to a resumable upload URL return the blob's information in the response body?

  6. Capstan commented on Jun 8, 2016

    @Capstan
    Contributor

    @mziccard I would be surprised to find that it does not return that information. What's the behavior you're seeing? What are you using for your alt parameter?

  7. mziccard commented on Jun 8, 2016

    @mziccard
    Contributor

    I am requesting a resumable upload URL with:

    POST https://www.googleapis.com/upload/storage/v1/b/test-bucket/o?uploadType=resumable&name=test-file
    (blob information in the body)
    

    Which returns the resumable URL in the body:

    https://www.googleapis.com/upload/storage/v1/b/test-bucket/o?uploadType=resumable&name=test-blob&upload_id=some-long-upload-id
    

    I upload the file with:

    POST https://www.googleapis.com/upload/storage/v1/b/test-bucket/o?uploadType=resumable&name=test-blob&upload_id=some-long-upload-id
    

    The blob is correctly created, upload is successful but this latest request does not return blob information back.

  8. mziccard commented on Jul 22, 2016

    @mziccard
    Contributor

    @Capstan any update on this?

  9. Capstan commented on Aug 10, 2016

    @Capstan
    Contributor
  10. 17 remaining items

  11. added a commit that references this issue on Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

🚨 criticalP0 critical issue. Requires immediate fixapi: storageIssues related to the Cloud Storage API.performancepriority: p2Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions