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 — Fix auth performance degradation in >= v0.14.0 / cache Google auth client per config · Issue #674 · googleapis/google-cloud-node

Fix auth performance degradation in >= v0.14.0 / cache Google auth client per config #674

New issue
Copy link
New issue
Copy link
Closed
Closed
Fix auth performance degradation in >= v0.14.0 / cache Google auth client per config#674
Copy link
Assignees
robertdimarco

Description

@robertdimarco
robertdimarco
opened on Jun 18, 2015
Issue body actions

The v0.14.0 release of this module included a change in the underlying dependency used for Google authentication, from the google-service-account module to google-auth-library (see eae1b7d). During routine service benchmarking as part of our upgrade to v0.15.0, I noticed a 50% decrease in throughput for our proxy server when asked to serve 10k small files.

A super-simple example is shown below, which directly calls into utils.makeAuthorizedRequest(...). This script makes 100 requests to GCS for file metadata, serially, and exits on completion. On v0.13.2, this script successfully completes in ~20-25 seconds, while in v0.14.0 and v0.15.0 it completes in ~45-50 seconds.

var util = require('./node_modules/gcloud/lib/common/util.js')

var config = {
  keyFile: "[redacted]",
  projectId: "[redacted]",
  scopes: [ 'https://www.googleapis.com/auth/devstorage.full_control' ]
};

var reqOpts = { method: 'GET', qs: null, uri: '[redacted]', json: true };

var makeAuthorizedRequest;
if (util.makeAuthorizedRequestFactory) { // >= v0.14.0
  makeAuthorizedRequest = util.makeAuthorizedRequestFactory(config)
} else { // v0.13.2
  makeAuthorizedRequest = util.makeAuthorizedRequest(config)
}

var n = 100;
function next() {
  if (n > 0) {
    run(function() {
      setTimeout(next, 0);
    });
  } else {
    process.exit();
  }
}
function run(cb) {
  if (n > 0) {
    makeAuthorizedRequest(reqOpts, function(err, resp, req) {
      if (err) {
        console.error(err);
        process.exit(1);
      }
      cb();
    })
  }
}
next();

This difference is fully accounted for through additional time spent in util.authorizeRequest(...). On v0.13.2, the call to authorize(...) is essentially a no-op if you are using a service account credential, and network I/O is not required.

This is caused by creating a new instance of GoogleAuth in util.getAuthClient(...), effectively blowing away the cached bearer token and causing a new one to be generated for each request.

I'll follow-up with a PR addressing this issue in the next 24 hours.

Activity

  1. ryanseys commented on Jun 18, 2015

    @ryanseys
    ryanseys
    on Jun 18, 2015
    Contributor
    More actions

    Take a look at #661. It might be what you're referring to. Let us know if/if not that's the case.

  2. robertdimarco commented on Jun 18, 2015

    @robertdimarco
    robertdimarco
    on Jun 18, 2015
    ContributorAuthor
    More actions

    @ryanseys Ah yes, that's it! Apologies for not seeing it. I'll close this out as a dupe.

  3. robertdimarco
    closed this as completedon Jun 18, 2015
  4. JustinBeckwith
    assigned
    robertdimarco
    on Feb 1, 2021
  5. sofisl
    added 2 commits that reference this issue on Oct 11, 2022

    chore(main): release 5.0.1 (#674)

    525b036

    chore(main): release 5.0.1 (#674)

    ea120b2
  6. sofisl
    added a commit that references this issue on Nov 10, 2022

    docs: clarify how to choose between v3 and v2 variants of the API (#674)

    4f9782e
  7. sofisl
    added a commit that references this issue on Nov 17, 2022

    chore(main): release 3.1.1 (#674)

    1d42210
  8. sofisl
    added 7 commits that reference this issue on Jan 27, 2026

    build: fix typo in publish (#674)

    a526eb9

    build: fix typo in publish (#674)

    2cb012f

    build: fix typo in publish (#674)

    0817b9c

    build: fix typo in publish (#674)

    b303493

    build: fix typo in publish (#674)

    a0adfd2

    test(samples): test all samples and not just tables (#674)

    94af332

    migrate code from googleapis/cloud-profiler-nodejs (#7087)

    288deb4
  9. sofisl
    added a commit that references this issue on Feb 26, 2026

    build: add Node 12 remove Node 11 (#674)

    657e638
  10. GautamSharda
    added 2 commits that reference this issue on Mar 5, 2026

    fix!: populate k8s_container rather than container (#674)

    f3f6857

    feat: Customize retry implementation (#680)

    455be01
  11. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    fix(deps): update dependency @google-cloud/paginator to v3 (#674)

    be79705

    fix(deps): update dependency @google-cloud/paginator to v3 (#674)

    33c874a
  12. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    fix(deps): update dependency @google-cloud/paginator to v3 (#674)

    981f19d
  13. thiyaguk09
    added a commit that references this issue on May 5, 2026

    fix(deps): update dependency @google-cloud/paginator to v3 (googleapi…

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

Metadata

Metadata

Assignees

  • @robertdimarco
    robertdimarco

Labels

No labels
No labels

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.