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 — Slow Storage uploads and high CPU usage · Issue #397 · googleapis/google-cloud-node

Slow Storage uploads and high CPU usage #397

New issue
Copy link
New issue
Copy link
Closed
Closed
Slow Storage uploads and high CPU usage#397
Copy link
Assignees
ryanseys
Labels
🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.
Milestone
Storage Stable

Description

@cbraynor
cbraynor
opened on Feb 17, 2015
Issue body actions

I'm seeing very slow uploads when sending large numbers of medium-sized files to storage - in the order of it taking 10x the time compared to uploading to S3. I also see excessive CPU usage during this time.

This Gist is a repro in the form of a side-by-side comparison uploading the same set of 750 medium-sized random text files to S3 using knox and to GCS using gcloud-node

gsutil can upload the same number of files just as quickly as anything to S3, so I'm pretty sure it's not the service itself.

I've tried limiting the request module's default maxSockets to 5 or 10 for the request pool but that didn't seem to help. I have a hunch it's the sheer number of outstanding requests or streams that's causing node to spin its wheels and that maybe some form of global queue could fix it, but I haven't been able to validate that yet.

Any help getting this into a usable state would be much appreciated

Activity

Next
  1. jgeewax
    added
    api: storageIssues related to the Cloud Storage API.
    perf
    on Feb 17, 2015
  2. jgeewax
    added this to the Storage Stable milestone on Feb 17, 2015
  3. stephenplusplus commented on Feb 17, 2015

    @stephenplusplus
    stephenplusplus
    on Feb 17, 2015
    Contributor
    More actions

    Thanks for the detailed breakdown. For me, the gcloud uploads have completed between 88-90 seconds consistently. However, there are two things that are on by default with every write stream which could be contributing towards higher memory usage and slower speeds overall:

    1. Data integrity - a hash is progressively built during an upload that is compared against the hash returned from the API when the upload is complete
    2. Resumable - writes to a tmp file to keep track of the state of an upload

    Shutting these off improved my speeds from 88-90 to 65-67. I'm not sure if the others (knox or gsutil) use these techniques as well.

  4. cbraynor commented on Feb 17, 2015

    @cbraynor
    cbraynor
    on Feb 17, 2015
    Author
    More actions

    Ok, so it looks like you're right and a lot of the issue is it being CPU-bound computing the hash - I'm testing on multi-core machines that don't have huge individual processors and I get a 5x improvement turning off the validate functionality. It's still not as fast as the knox implementation but it certainly is a good start for now

  5. ryanseys commented on Feb 17, 2015

    @ryanseys
    ryanseys
    on Feb 17, 2015
    Contributor
    More actions

    Should we consider turning validation to false by default?

    Reacted by Michael Prentice
  6. jgeewax commented on Feb 18, 2015

    @jgeewax
    jgeewax
    on Feb 18, 2015
    Contributor
    More actions

    I think that's an issue for discussion.

    I'd also like to get an idea of what gsutil is doing and how it compares from a performance standpoint. If the only differences are runtime and validation, then I think our work is done and we just need to make a call about whether to validate hashes by default...

  7. dhermes commented on Feb 18, 2015

    @dhermes
    dhermes
    on Feb 18, 2015
    Contributor
    More actions

    @jgeewax gsutil uses the hashlib.md5 (standard library) and a third-party crcmod which uses a C extension for speedups.

    Also, in terms of turning off checks, @thobrla filed googleapis/google-cloud-python#547 (via @silvolu) with us and said:

    We should allow to override the configuration for the checks (e.g. use only
    crc32c, do not perform checks), but it should be strongly discouraged.

  8. ryanseys commented on Feb 18, 2015

    @ryanseys
    ryanseys
    on Feb 18, 2015
    Contributor
    More actions

    It looks to me like gsutil is hashing the entire file at the end, where as we hash it as the contents comes in. You would think that doing it at the end would have worse performance, but doing it all at the end might reduce thrashing and reduce our CPUs context switching.

  9. jgeewax commented on Feb 18, 2015

    @jgeewax
    jgeewax
    on Feb 18, 2015
    Contributor
    More actions

    Interesting... Might be worth a benchmark...?

  10. ryanseys commented on Feb 18, 2015

    @ryanseys
    ryanseys
    on Feb 18, 2015
    Contributor
    More actions

    I ran on my machine and didn't see a huge spike in CPU (~20% max) but certainly was more time consuming to upload with default settings (validation and resumable is on). I'm running on S3 region us-east-1 and I'm located in Ottawa (mid-east Canada). Seems S3 is really sporadic with performance, as you can see by the fluctuation in numbers with no change in settings. GCS seems a little more stable in that regard.
    Here's my numbers:

    With default settings:

    Run 1:

    Finished uploading to s3 in 47.792 seconds
    Finished uploading to GCS in 91.161 seconds

    Run 2:

    Finished uploading to s3 in 41.566 seconds
    Finished uploading to GCS in 92.455 seconds

    Run 3:

    Finished uploading to s3 in 47.247 seconds
    Finished uploading to GCS in 93.156 seconds

    Without validation or resumable GCS:

    Run 1:

    Finished uploading to s3 in 39.286 seconds
    Finished uploading to GCS in 54.476 seconds

    Run 2:

    Finished uploading to s3 in 57.732 seconds
    Finished uploading to GCS in 56.977 seconds

    Run 3:

    Finished uploading to s3 in 42.917 seconds
    Finished uploading to GCS in 52.861 seconds

    I haven't tried with gsutil yet or moving hashing to run at the end.

    Reacted by Michael Prentice
  11. jgeewax commented on Feb 18, 2015

    @jgeewax
    jgeewax
    on Feb 18, 2015 via email
    Contributor
    More actions
    Do we have numbers comparing gsutil to GCS versus gcloud-node to GCS?
  12. ryanseys commented on Feb 18, 2015

    @ryanseys
    ryanseys
    on Feb 18, 2015
    Contributor
    More actions

    I'm working on that now.

  13. ryanseys commented on Feb 18, 2015

    @ryanseys
    ryanseys
    on Feb 18, 2015
    Contributor
    More actions

    So I used the following command to upload the directory of pre-extracted files to a bucket on GCS using gsutil. The -m option stands for multi-threading or something and allows the uploads to occur in parallel, greatly speeding up the upload time:

    $ time gsutil -m cp -r tmp gs://my-test-bucket/my-test-folder

    Results:
    22.04s user 2.93s system 71% cpu 34.866 total
    21.00s user 2.99s system 67% cpu 35.477 total
    21.66s user 2.92s system 70% cpu 35.069 total

  14. thobrla commented on Feb 18, 2015

    @thobrla
    thobrla
    on Feb 18, 2015
    More actions

    When possible, gsutil hashes on the fly. I think there's only one case when using the boto library (which is not the default for interacting with GCS) where it hashes at the end.

  15. 47 remaining items

  16. sofisl
    added a commit that references this issue on Jan 28, 2026

    fix: minor spelling mistake (#397)

    3cdda34
  17. GautamSharda
    added a commit that references this issue on Feb 2, 2026

    chore: add protos/ to .eslintignore (#397)

    926bc8d
  18. sofisl
    added a commit that references this issue on Feb 3, 2026

    feat(geo): add support for geography (#397)

    c75cce3
  19. GautamSharda
    added a commit that references this issue on Feb 3, 2026

    chore: add protos/ to .eslintignore (#397)

    b7fb6e0
  20. sofisl
    added 2 commits that reference this issue on Feb 4, 2026

    build: script updated for new Windows image (#397)

    e84aef3

    build: allow Node 10 on presubmit to push to codecov (#397)

    fa2fa7f
  21. sofisl
    added a commit that references this issue on Feb 17, 2026

    build: allow Node 10 on presubmit to push to codecov (#397)

    d065571
  22. GautamSharda
    added a commit that references this issue on Feb 25, 2026

    chore(deps): update dependency @types/sinon to v17 (#397)

    f5f72e1
  23. sofisl
    added a commit that references this issue on Feb 26, 2026

    chore: remove old issue template (#397)

    e98b046
  24. GautamSharda
    added 2 commits that reference this issue on Mar 5, 2026

    build: use linkinator for docs test (#397)

    7f9ee6c

    fix: @types/[email protected] breaks paginate/promisifyAll (#397)

    289cca1
  25. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    refactor: use async/await in system tests (#397)

    b0055a1

    refactor: use async/await in system tests (#397)

    dbeb91d
  26. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    refactor: use async/await in system tests (#397)

    f2f2cde
  27. thiyaguk09
    added a commit that references this issue on May 5, 2026

    refactor: use async/await in system tests (googleapis#397)

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

Metadata

Metadata

Assignees

  • @ryanseys
    ryanseys

Labels

🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    • Storage Stable

    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.