GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Low default chunk size slows GCS downloads · Issue #2222 · googleapis/google-cloud-python

Low default chunk size slows GCS downloads #2222

New issue
Copy link
New issue
Copy link
Closed
Closed
Low default chunk size slows GCS downloads#2222
Copy link
Assignees
tseaver
Labels
api: storageIssues related to the Cloud Storage API.performancepriority: p2Moderately-important priority. Fix may not be included in next release.type: processA process-related concern. May include testing, release, or the like.

Description

@davidn
davidn
opened on Aug 30, 2016
Issue body actions

Steps to reproduce:

  1. Create multi-gb file gs://your_bucket/obj
  2. Test gsutil speed with "gsutil cp gs://your_bucket/obj /local/copy"
  3. download via gcloud.storage.Blob.download_to_filename (see sample script below)

Expected result: similar timing

Actual result on my machine: gsutil downloads 4.6GB in 1min14sec, gcloud.storage takes 20min.

If I add blob.chunk_size=1<<30 prior to download_to_filename, gcloud.storage takes the same time as gsutil to the second.

Sample script:

#!/usr/bin/env python
import httplib2
httplib2.debuglevel=4
import gcloud.storage

bucket_id = 'BUCKET'
blob_id = 'OBJECT'
url = 'gs://%s/%s' % (bucket_id, blob_id)
project = 'dnewgas-test-1'
client = gcloud.storage.client.Client(project)
bucket = client.get_bucket(bucket_id)
blob = bucket.get_blob(blob_id)
//blob.chunk_size=1<<30
blob.download_to_filename('/tmp/down')
Reacted by protoforge

Activity

  1. dhermes
    added
    api: storageIssues related to the Cloud Storage API.
    on Sep 2, 2016
  2. dhermes commented on Sep 2, 2016

    @dhermes
    dhermes
    on Sep 2, 2016
    Contributor
    More actions

    @thobrla Is 2**30 a better chunk size than 2**20? Should we base it on the file size first?

  3. thobrla commented on Sep 2, 2016

    @thobrla
    thobrla
    on Sep 2, 2016
    More actions

    What download resume methods does gcloud-python support - in other words, how do you recover from transient service or network issues? If support is based on downloading entire chunks successfully, then chunk size is implicitly a tradeoff between performance vs. reliability.

    But ideally you wouldn't have a chunk size at all - you would request the entire object in a single request, and in the presence of a transient network or service error, pick up where you left off based on how many bytes you had successfully downloaded.

  4. davidn commented on Sep 2, 2016

    @davidn
    davidn
    on Sep 2, 2016
    Author
    More actions

    I don't think the JSON API has a good resume mechanism. The XML API allows resuming with range headers. gsutil uses JSON API with chunked downloading like this and 100MB chunks I believe.

  5. thobrla commented on Sep 2, 2016

    @thobrla
    thobrla
    on Sep 2, 2016
    More actions

    The JSON API supports range headers as well.

    gsutil does not use chunking for single object downloads via the JSON API. It does slice objects into multiple ranges so that it can download them in parallel, but whether that slicing occurs or not, a single range request for the entire range of each slice is set.

    You can verify the simple (non-sliced) case by running:
    gsutil -D -o 'GSUtil:sliced_object_download_threshold=0' cp gs://your-bucket/large-object local-file

  6. tseaver
    added
    performance
    on Oct 13, 2016
  7. lukesneeringer
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Apr 19, 2017
  8. chemelnucfin
    added
    type: processA process-related concern. May include testing, release, or the like.
    on Jan 9, 2018
  9. chemelnucfin
    assigned
    chemelnucfin
    ,
    dhermes
    and
    tseaver
    on Jan 15, 2018
  10. tseaver commented on Feb 27, 2018

    @tseaver
    tseaver
    on Feb 27, 2018
    Contributor
    More actions

    Since e442cd2, blobs no longer set a non-None default chunk size.

    Emulating the "slice-and-reassemble" behavior of gsutil cp downloads would be a feature request, rather than a performance bug.

  11. tseaver
    closed this as completedon Feb 27, 2018
  12. theacodes
    unassigned
    dhermes
    and
    chemelnucfin
    on Sep 28, 2018
  13. yan-hic commented on Nov 7, 2018

    @yan-hic
    yan-hic
    on Nov 7, 2018
    More actions

    @tseaver Are you aware of that feature being planned for or requested ?

    I like to use slice-and-compose in GCF and since gsutil cannot be used there, it must be through the client libs (Python or Node).

    Btw, wondering instead of composing, can a resumable upload work in multi-threading ? I.e. each thread uploads a slice in chunks of 8MB or so. Not sure if GCS expects slices to be loaded sequentially.

  14. thobrla commented on Nov 7, 2018

    @thobrla
    thobrla
    on Nov 7, 2018
    More actions

    GCS does not currently support non-sequential writes to a resumable upload.

  15. yan-hic commented on Nov 7, 2018

    @yan-hic
    yan-hic
    on Nov 7, 2018 via email
    More actions
    Thank you - feature requested (issuetracker) !
    …
    On Wed, Nov 7, 2018 at 3:22 PM thobrla ***@***.***> wrote: GCS does not currently support non-sequential writes to a resumable upload. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#2222 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AYDkSRuEer6UBjjoavsaQ1kh1h9jP94eks5us0EggaJpZM4JwzDk> .
  16. parthea
    added 2 commits that reference this issue on Mar 2, 2026

    samples: add samples from pubsub/cloud-client (#134)

    8c90f22

    Pub/Sub: publish with error-handling comments [(#2222)](GoogleCloudPl…

    39e018b
  17. parthea
    added 2 commits that reference this issue on Apr 1, 2026

    fix: Correct connection normalization in blob system tests (#2222)

    319c1ef

    test: re-enable Multimodal tests (#2235)

    778d1d1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @tseaver
    tseaver

Labels

api: storageIssues related to the Cloud Storage API.performancepriority: p2Moderately-important priority. Fix may not be included in next release.type: processA process-related concern. May include testing, release, or the like.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.