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 — require('google-cloud') takes 12 seconds to execute · Issue #1605 · googleapis/google-cloud-node

require('google-cloud') takes 12 seconds to execute #1605

New issue
Copy link
New issue
Copy link
Closed
Closed
require('google-cloud') takes 12 seconds to execute#1605
Copy link
Assignees
callmehiphop
Labels
core

Description

@martincad
martincad
opened on Sep 20, 2016
Issue body actions

The require for the google-cloud package takes a lot to execute, about 12 seconds.

Environment details

  • OS: Ubuntu 14.04 / OSX 10.11.6
  • Node.js version: v4.2.3 / v4.2.3
  • npm version: 2.14.7 / 2.14.7
  • google-cloud-node version: 0.40.0

Steps to reproduce

  1. mkdir tmp
  2. cd tmp
  3. npm init -y
  4. npm install --save google-cloud
  5. npm dedupe
  6. time node -e "require('google-cloud')"
real 0m10.932s
user 0m8.482s
sys 0m1.036s

Activity

  1. stephenplusplus commented on Sep 20, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 20, 2016
    Contributor
    More actions

    Ouch. We will look into that.

  2. callmehiphop
    added
    core
    on Sep 20, 2016
  3. callmehiphop commented on Sep 20, 2016

    @callmehiphop
    callmehiphop
    on Sep 20, 2016
    Contributor
    More actions

    This actually looks to be related to another issue (#1590) we're looking into. Have you thought about upgrading to npm3? Testing locally cut it down from 12 seconds to about 1 for me.

  4. martincad commented on Sep 25, 2016

    @martincad
    martincad
    on Sep 25, 2016
    Author
    More actions

    @callmehiphop we are using gcloud package (the old one) on a Production environment and were planning to upgrade to google-cloud lib, but we are using Node Argon, and don't think we can migrate until Node 6 is flagged as LTS.

    Do you think is there any work-around for node 4 and npm 2 to avoid this huge load time ?

  5. stephenplusplus commented on Sep 25, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 25, 2016
    Contributor
    More actions

    Possibly running 'npm dedupe' after installing dependencies, and before starting your program. You can also upgrade npm to 3 'npm install -g npm' without affecting the Node version.

  6. martincad commented on Sep 25, 2016

    @martincad
    martincad
    on Sep 25, 2016
    Author
    More actions

    @s3ththompson The issue can be reproduce by just installing google-cloud package on an empty directory, so there is nothing to dedupe. (Just in case I tested it, but is still taking a lot).

  7. stephenplusplus commented on Sep 25, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 25, 2016
    Contributor
    More actions

    dedupe should flatten all of our dependencies between our modularized google-cloud-* packages into one common place, which should make the 'require' times quicker, since they're not scattered all over the disk. So after installing, you ran 'npm dedupe', then ran your program, and still experienced 12 second startup times?

  8. martincad commented on Sep 25, 2016

    @martincad
    martincad
    on Sep 25, 2016
    Author
    More actions

    Let me share the steps with you, just in case I'm doing something wrong:

    1. mkdir tmp
    2. cd tmp
    3. npm install google-cloud
    4. npm dedupe
    5. time node -e "require('google-cloud')"

    real 0m10.932s
    user 0m8.482s
    sys 0m1.036s

    I have reproduced this on Mac and Ubuntu (14.04), weird why nobody reported this

  9. stephenplusplus commented on Sep 25, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 25, 2016
    Contributor
    More actions

    Do you end up with a node_modules directory inside of tmp? Maybe try 'npm init -y && npm install --save google-cloud'. Not sure if dedupe will work without a package.json. Is there any sign the dedupe command is working?

  10. martincad commented on Sep 25, 2016

    @martincad
    martincad
    on Sep 25, 2016
    Author
    More actions

    @stephenplusplus You are right, npm dedupe was not doing anything without a package.json. The bad thing if after adding the package and run dedupe ( and seeing a lot of dedupe output which was not there before) the bug still persists ( at least on Mac ).

    Will try the same thing on Ubuntu trusty later and will let you know.

    Thanks

  11. stephenplusplus commented on Sep 26, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 26, 2016
    Contributor
    More actions

    I believe this is a symptom of having our sub-modules (i.e. @google-cloud/storage) depend on different versions of @google-cloud/common.

    The common package has a dependency on grpc, which is a massive one. Today, we will release all of our sub-modules and a new google-cloud, which will all have a dependency on the same version of grpc. That should mean after running dedupe, the require times should be more in line with what you'd expect.

    I'll update here once the new release is out.

  12. stephenplusplus
    added
    perf
    on Sep 26, 2016
  13. stephenplusplus commented on Sep 26, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 26, 2016
    Contributor
    More actions

    After the release tonight of v0.41.0, the times went down dramatically for me:

    node -e "require('google-cloud')"
    2.36s user 0.27s system 56% cpu 4.692 total
    

    Can you let me know if you're seeing the same improvement if you repeat the steps from the opening post?

  14. callmehiphop
    closed this as completedin #1632on Sep 27, 2016
  15. stephenplusplus commented on Sep 27, 2016

    @stephenplusplus
    stephenplusplus
    on Sep 27, 2016
    Contributor
    More actions

    We're definitely much better now with v0.41.2, a release we just put out which uses shrinkwrap to force deduplication:

    $ time node -e "require('google-cloud')"
    0.93s user 0.11s system 101% cpu 1.025 total
  16. martincad commented on Sep 27, 2016

    @martincad
    martincad
    on Sep 27, 2016
    Author
    More actions

    @s3ththompson worked like a charm. Thanks a lot:

    time node -e "require('google-cloud')"

    real 0m0.831s
    user 0m0.638s
    sys 0m0.097s

    Reacted by Stephen
    Reacted by Stephen
  17. JustinBeckwith
    assigned
    callmehiphop
    on Feb 1, 2021
  18. miguelvelezsa
    added a commit that references this issue on Jul 23, 2025

    fix: raise error on retryable error when max retries is 0 (#1605)

    475437a
  19. sofisl
    added 2 commits that reference this issue on Feb 25, 2026

    test: conformance testing for retries (#1566)

    9757193

    Revert "fix: clarify the gax-nodejs usage in README (#1352)" (#1409) (#…

    1e44a97
  20. GautamSharda
    added a commit that references this issue on Mar 11, 2026

    chore(main): release 3.1.1 (#1605)

    fe2c7c6
  21. sofisl
    added 2 commits that reference this issue on Mar 17, 2026

    fix: raise error on retryable error when max retries is 0 (#1605)

    cdfdda3

    chore(main): release 4.6.2 (#1605)

    adcf46c
  22. thiyaguk09
    added a commit that references this issue on Mar 18, 2026

    test: conformance testing for retries (googleapis#1566)

    055f2e7
  23. feywind
    added a commit that references this issue on Mar 27, 2026

    chore(main): release 3.1.1 (#1605)

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

Metadata

Metadata

Assignees

  • @callmehiphop
    callmehiphop

Labels

core

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.