Skip to content

Slow gcloud storage upload for small files? #1078

Description

@srlowe

I'm seeing upload times of over 6000ms for small 10kB files. Please could someone confirm if this is expected for Google cloud uploads, or is it more likely there is some client problem happening?

I've tried disabling resumable and validation, and this improves things a bit, but not substantially. Our upload code looks like this:

    var options = {
        resumable : false,
        validation: false
    };

    var remoteWriteStream = bucket.file(fileName).createWriteStream(options);
    remoteWriteStream.on('finish', function(){ callback(); });
    remoteWriteStream.on('error',  function(err){ callback(err); });
    sourceStream.pipe(remoteWriteStream);

Activity

  1. stephenplusplus commented on Jan 20, 2016

    @stephenplusplus
    Contributor

    Can you run another upload immediately after the first one completes and measure the time difference?

  2. changed the title [-]Extremely slow gcloud storage upload for small files?[/-] [+]Slow gcloud storage upload for small files?[/+] on Jan 20, 2016
  3. srlowe commented on Jan 20, 2016

    @srlowe
    Author

    Sure. It seems subsequent calls are faster. Here's the same upload repeated 5x in a row (~10kB with resume and validation off):

    4935ms, 3336ms, 2336ms, 2551ms, 2695ms.

    Still seems on the slow side to me - what do you think?

    Maybe my expectations are wrong though. I suppose there are overheads like auth etc, which disadvantage small files.

  4. jgeewax commented on Jan 20, 2016

    @jgeewax
    Contributor

    This definitely seems wrong to me. Uploading 10k shouldn't be taking 1000
    ms. That said, GCS is optimized for throughput (aka, large file overall
    upload time) rather than latency (small file overall upload time), so it's
    possible (just shitty...)

  5. srlowe commented on Jan 20, 2016

    @srlowe
    Author

    @jgeewax - Right, that was my feeling too.

    Does anyone know if there's some kind of debug mode, which might give some visibility into what's happening, time-wise?

  6. stephenplusplus commented on Jan 20, 2016

    @stephenplusplus
    Contributor

    With my own tests, I complete uploads consistently under 1s. It went up to around 3 if I uploaded to a bucket overseas. Any chance location could be playing a role?

  7. jgeewax commented on Jan 20, 2016

    @jgeewax
    Contributor
  8. srlowe commented on Jan 20, 2016

    @srlowe
    Author

    Thanks, I tried both US and EU storage locations, but times seemed similar (I'm in EU).

  9. jgeewax commented on Jan 20, 2016

    @jgeewax
    Contributor
  10. stephenplusplus commented on Jan 20, 2016

    @stephenplusplus
    Contributor

    If you have gsutil CLI tool installed, you can see what times you get there, just to see if there are any huge differences:

    time gsutil cp 10kfile.txt gs://your-bucket
  11. stephenplusplus commented on Jan 20, 2016

    @stephenplusplus
    Contributor
  12. srlowe commented on Jan 20, 2016

    @srlowe
    Author

    @jgeewax , @stephenplusplus - Thanks, I'll test traceroute, gsutil and that test script and report back.

    Worth noting that I'm doing this from an external machine, not google-compute, and am specifying credentials like so (which may be a factor):

    var storage = gcloud.storage({
        projectId   : xxx,
        credentials : {
              client_email : yyy,
              private_key  : zzz
    });
    
  13. stephenplusplus commented on Jan 26, 2016

    @stephenplusplus
    Contributor

    The credentials will cause a delay, but will only affect the first request. Have you had a chance to run any more tests?

    @mziccard any chance you can run the sample here and report your findings? https://gist.github.com/stephenplusplus/15d0d7e96a40887c74aa

  14. stephenplusplus commented on Feb 4, 2016

    @stephenplusplus
    Contributor

    @bgSosh I'm going to close this out as this is likely a geographic issue, beyond what this library can help with. If you have a chance to run some more tests or find anything we might not have thought of that would help, please re-open.

  15. Eve-rine commented on Nov 9, 2020

    @Eve-rine

    Hello guys my uploads are taking too long for small files of 500kbs upto 98 seconds how do I sort this issue please

  16. stephenplusplus commented on Nov 9, 2020

    @stephenplusplus
    Contributor

    @Evrine19 please open a new issue and follow the issue template. That will help us get up to speed and see if we can reproduce the issue you're having. Thanks!

  17. added a commit that references this issue on Jul 23, 2025
  18. added a commit that references this issue on Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: storageIssues related to the Cloud Storage API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions