-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Higher latency seen with pubsub publish call #441
Comments
The only network call made is the publish API call. The slow start (is 178ms slow?) could be from reading and parsing your key file/wading through the deep Node call stack, as that's lazily done when the first API call needs to be made. |
Thanks Stephen. I confirmed that the subsequent calls are relatively faster (updated the snippets above, and I got average ~170ms).
However, the actual API latency of ~170ms is slow too. When I do the same thing with golang, the average latency is around 70ms or so. |
Not sure what we should do here for increasing the performance. It could be related to NodeJS performance vs. golang? |
Might be. Is the x2 latency expected? Do you know any good profilers to dig into such performance issue? |
I'm not sure. Go is pretty fast but I can't see it being 2x faster with the network in the middle. I've tried to profile other use case before with minimal luck. NodeJS seems mediocre at best for profile-ability. I might just have not thrown enough hours at the problem. |
Hi! Are there any news on this issue? Thanks! |
Hi, Once again, high latency comes back as an issue, this time related to topic creation and subscription creation via gcloud-node. Creating a topic takes about Here is an example script: 'use strict';
var gcloud = require('gcloud');
var pubsub = gcloud.pubsub({
projectId: 'myAwesomeProject',
});
console.time('Pub/Sub topic creation');
return pubsub.createTopic('test1', function(err, topicObj) {
console.timeEnd('Pub/Sub topic creation');
console.time('Pub/Sub subscriber creation');
return topicObj.subscribe('subscriber_test1', {ackDeadlineSeconds: 600}, function(err) {
console.timeEnd('Pub/Sub subscriber creation');
return process.exit(0);
});
}); The results:
The GCE instance used for testing is a GCE
Now, it is hard to know if the problem is actually the GCE instance, the Pub/Sub cloud @ GCE or the Node.js library itself from my position, but these response times are awefull nonetheless. Would you know of any way to diagnose better this issue? Thanks a bunch! I'm not a native english speaker, so my tone may sound rude, I hope I don't give that impression :x [EDIT]: please note I did not provide any expected timed result or anything, because I have no idea what to compare it to. However, in the context of managed groups on GCE, it seems awefully slow and, in many cases with overcrowded REST servers, leads to even worse results and, sometimes, timeouts from the GCE load balancer. 3 seconds seems rea~lly slow :/ |
@tmatsuo : Any chance you can comment on this? Or loop in someone on the Pub/sub team who can? |
@tmatsuo ? |
Do you still see ~3000ms latency? I tested your code and it shows:
|
@Pampattitude - I'm going to close the issue as it appears it has resolved itself over the course of the last several months (sorry for that delay). If you're still experiencing the latency, please re-open. |
gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f
gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f
gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f
gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/sinon](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^9.0.0` -> `^10.0.0`](https://renovatebot.com/diffs/npm/@types%2fsinon/9.0.11/10.0.0) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/compatibility-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/confidence-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-bigquery-data-transfer).
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/sinon](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^9.0.0` -> `^10.0.0`](https://renovatebot.com/diffs/npm/@types%2fsinon/9.0.11/10.0.0) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/compatibility-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/confidence-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-bigquery-data-transfer).
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/ba2d388f-b3b2-4ad7-a163-0c6b4d86894f/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: googleapis/synthtool@05de3e1
…d config for cloud-rad for nodejs (#441) This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/91408a5a-0866-4f1e-92b1-4f0e885b0e2e/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: googleapis/synthtool@21f1470 Source-Link: googleapis/synthtool@388e10f Source-Link: googleapis/synthtool@d82decc
[PR](googleapis/gapic-generator-typescript#878) within updated gapic-generator-typescript version 1.4.0 Committer: @summer-ji-eng PiperOrigin-RevId: 375759421 Source-Link: googleapis/googleapis@95fa72f Source-Link: googleapis/googleapis-gen@f40a343
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/7d84eafd-4925-434f-9ffd-6407671972cb/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 361273630 Source-Link: googleapis/googleapis@5477122
* updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip]
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [uuid](https://togithub.com/uuidjs/uuid) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/uuid/7.0.3/8.0.0) | --- ### Release Notes <details> <summary>uuidjs/uuid</summary> ### [`v8.0.0`](https://togithub.com/uuidjs/uuid/blob/master/CHANGELOG.md#​800-httpsgithubcomuuidjsuuidcomparev703v800-2020-04-29) [Compare Source](https://togithub.com/uuidjs/uuid/compare/v7.0.3...v8.0.0) ##### ⚠ BREAKING CHANGES - For native ECMAScript Module (ESM) usage in Node.js only named exports are exposed, there is no more default export. ```diff -import uuid from 'uuid'; -console.log(uuid.v4()); // -> 'cd6c3b08-0adc-4f4b-a6ef-36087a1c9869' +import { v4 as uuidv4 } from 'uuid'; +uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d' ``` - Deep requiring specific algorithms of this library like `require('uuid/v4')`, which has been deprecated in `uuid@7`, is no longer supported. Instead use the named exports that this module exports. For ECMAScript Modules (ESM): ```diff -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; uuidv4(); ``` For CommonJS: ```diff -const uuidv4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); uuidv4(); ``` ##### Features - native Node.js ES Modules (wrapper approach) ([#​423](https://togithub.com/uuidjs/uuid/issues/423)) ([2d9f590](https://togithub.com/uuidjs/uuid/commit/2d9f590ad9701d692625c07ed62f0a0f91227991)), closes [#​245](https://togithub.com/uuidjs/uuid/issues/245) [#​419](https://togithub.com/uuidjs/uuid/issues/419) [#​342](https://togithub.com/uuidjs/uuid/issues/342) - remove deep requires ([#​426](https://togithub.com/uuidjs/uuid/issues/426)) ([daf72b8](https://togithub.com/uuidjs/uuid/commit/daf72b84ceb20272a81bb5fbddb05dd95922cbba)) ##### Bug Fixes - add CommonJS syntax example to README quickstart section ([#​417](https://togithub.com/uuidjs/uuid/issues/417)) ([e0ec840](https://togithub.com/uuidjs/uuid/commit/e0ec8402c7ad44b7ef0453036c612f5db513fda0)) ##### [7.0.3](https://togithub.com/uuidjs/uuid/compare/v7.0.2...v7.0.3) (2020-03-31) ##### Bug Fixes - make deep require deprecation warning work in browsers ([#​409](https://togithub.com/uuidjs/uuid/issues/409)) ([4b71107](https://togithub.com/uuidjs/uuid/commit/4b71107d8c0d2ef56861ede6403fc9dc35a1e6bf)), closes [#​408](https://togithub.com/uuidjs/uuid/issues/408) ##### [7.0.2](https://togithub.com/uuidjs/uuid/compare/v7.0.1...v7.0.2) (2020-03-04) ##### Bug Fixes - make access to msCrypto consistent ([#​393](https://togithub.com/uuidjs/uuid/issues/393)) ([8bf2a20](https://togithub.com/uuidjs/uuid/commit/8bf2a20f3565df743da7215eebdbada9d2df118c)) - simplify link in deprecation warning ([#​391](https://togithub.com/uuidjs/uuid/issues/391)) ([bb2c8e4](https://togithub.com/uuidjs/uuid/commit/bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7)) - update links to match content in readme ([#​386](https://togithub.com/uuidjs/uuid/issues/386)) ([44f2f86](https://togithub.com/uuidjs/uuid/commit/44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4)) ##### [7.0.1](https://togithub.com/uuidjs/uuid/compare/v7.0.0...v7.0.1) (2020-02-25) ##### Bug Fixes - clean up esm builds for node and browser ([#​383](https://togithub.com/uuidjs/uuid/issues/383)) ([59e6a49](https://togithub.com/uuidjs/uuid/commit/59e6a49e7ce7b3e8fb0f3ee52b9daae72af467dc)) - provide browser versions independent from module system ([#​380](https://togithub.com/uuidjs/uuid/issues/380)) ([4344a22](https://togithub.com/uuidjs/uuid/commit/4344a22e7aed33be8627eeaaf05360f256a21753)), closes [#​378](https://togithub.com/uuidjs/uuid/issues/378) </details> --- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-compute).
* updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* feat: make vision helpers work with JSON proto * lint
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/9610e861-65a2-4035-85ab-1303620c4597/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: googleapis/synthtool@363fe30
When issuing a Cloud Pub/Sub API publish call, and I'm experiencing a higher latency than expected.
expected: 70 - 100 ms
actual: ~300 ms
To reproduce this problem, you can run the pubsub-cmdline.js (inlined at the bottom) with the small modification below. Here is an example run:
$ ./pubsub-cmdline.js
Calling topic.publish at 1426005295668
Calling request at 1426005295846
Average: 314
Max: 314
1426005295846 - 1426005295668 = 178ms
It spends more than 1/2 of the total elapsed time before issuing the actual request. I suspect that there is a unnecessary RPC (presumably GCE metadata lookup?) before the actual API call. Since I'm using the service account from the json file, there shouldn't be such RPC. Do you think of anything that causes this?
Modification gcloud/lib/common/util.js: 400
just before calling request(authorizedReqOpts, function(err, res, body) {
pubsub-cmdline.js
I'm using the released version 0.12.0.
The text was updated successfully, but these errors were encountered: