0

I have 2 systems using Nodejs 16.19.0 - one on my local Windows 11 and another in a GKE pod running a Ubuntu 20 container. In both systems, I open an interactive Nodejs prompt and run the following, pointing to some IP address that I know will NOT reply and cause a timeout on the client side:

$ node # open interactive nodejs prompt and run the following at once:

console.log(new Date());
req=http.request('http://x.x.x.x');
req.on('error', ()=>{}); // just to cleanup the output
req.on('close', () => { console.log('close ' + new Date()); });

I print the start and end dates to see how long it takes the client to close with the timeout.

In my local system, it takes ~20 seconds. In the other system, it takes 130 seconds. I didn't configure anything special in my Node. Why is there a difference?

Also, the consequence of this, is that when I also add a "timeout" handler for, say, 30 seconds, it will NOT fire on Windows and WILL fire in the pod...

4
  • It could be possible due to network latency to answer your question we might need more information. Is it always taking more time on GKE prod? Try to run the network trace on both and see if there are any differences. It is possible there are some more filtering on your prod system that makes the request taking more time. Commented Jan 10, 2023 at 9:59
  • found a similar question with the right explanation: stackoverflow.com/questions/3586760/… Commented Jan 10, 2023 at 15:36
  • I think the question you tagged is to set timeout for HTTP request, however you are asking the time taken for HTTP request on dofferent system are different, is it correct? Commented Jan 11, 2023 at 3:15
  • that question's answer explains the diff between Win and Linux, like in my case Commented Jan 11, 2023 at 6:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.