You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With a simple servant service at http://localhost:3000/test, I get:
2024-09-05 03:47:47.018037777 UTC
Hello, world!
2024-09-05 03:47:47.271253156 UTC
Hello, world!
2024-09-05 03:47:47.272148168 UTC
Given that this is all local, I would have expected these requests to finish very fast. However, the first request takes about 250ms, only subsequent ones are fast.
I did some investigating, and it seems that getAddrInfo returns [::1]:3000 and 127.0.0.1:3000, in that order. The function firstSuccessful then attempts to connect to each of these, staggered by 250ms, which only succeeds for the second address.
Not sure if there is an easy/elegant solution to this, but it is very unfortunate that a simple connection to localhost incurs such a high latency on the first request.
The text was updated successfully, but these errors were encountered:
I have this code:
With a simple
servant
service athttp://localhost:3000/test
, I get:Given that this is all local, I would have expected these requests to finish very fast. However, the first request takes about 250ms, only subsequent ones are fast.
I did some investigating, and it seems that
getAddrInfo
returns[::1]:3000
and127.0.0.1:3000
, in that order. The functionfirstSuccessful
then attempts to connect to each of these, staggered by 250ms, which only succeeds for the second address.Not sure if there is an easy/elegant solution to this, but it is very unfortunate that a simple connection to
localhost
incurs such a high latency on the first request.The text was updated successfully, but these errors were encountered: