High Latency To Publish
See original GitHub issueHello,
I am using the publish function in a basic way:
const gPubsub = require('@google-cloud/pubsub');
const pubsub = gPubsub({
projectId: 'projectId',
});
const publish = (message, cbkPublish) => {
if (!message.topic)
return cbkPublish('No PubSub topic specified');
const topic = message.topic;
delete message.topic;
const publisher = pubsub.topic(topic).publisher();
const buff = Buffer.from(JSON.stringify(message));
publisher.publish(buff)
.then(() => cbkPublish(null))
.catch(err => cbkPublish(err));
};
return callback();
}
The problem is that I am experiencing a long time to publish, for a buffer length of 352 it takes 3608 ms to publish. Is there some settings to publish faster ? Am I doing something wrong ?
Environment Details:
Node: 8.1.4
google-cloud/pubsub: 0.16.5
Issue Analytics
- State:
- Created 6 years ago
- Comments:25 (5 by maintainers)
Top Results From Across the Web
What Is Network Latency? - AWS
Network latency is the delay in network communication. It shows the time that data takes to transfer across the network. Networks with a...
Read more >How to improve network latency in 3 steps - TechTarget
High latency can snarl network traffic and disrupt communications, resulting in unhappy end users. Check out these three steps to reduce and improve...
Read more >What Is Network Latency? Typical Causes & Ways to Reduce It
When communication delays are small, it's called low-latency network and longer delays, high-latency network. Any delay affects website ...
Read more >RabbitMQ latency in publishing messages - Stack Overflow
This latency is not observed when the publisher and subscriber runs on the same system. · This latency is not observed even when...
Read more >How to investigate high tail latency when using Cloud Spanner
In this blog post, we will talk about how to distinguish the high latency causes and also talk about some tips to improve...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I experienced a similar issue recently. Our use case is to publish a single message to a pubsub topic from within a web client request/response cycle (an express route).
I wrote this test script to evaluate the time it takes to publish a message.
It takes ~120ms to publish a message using the above test script in cloud shell which is longer than we were hoping for. I reached out to the gcp slack channel and tscanausa tested it on his end using this curl command:
curl_format.txt
data.json
with similar results. I’m happy to help profile the node client if you think it will help? I tried batching 100 messages at a time and the publish time didn’t vary much so it appears to take around 120ms whether I publish 1 message or x messages up to some value of x.
Yes, please, @aayusharora – don’t remove the settings. Set them explicitly. As I said, the default is to batch.