I have an AJAX query on my client that passes two parameters to a server:
var url = window.location.origin + \"/instanceStats\"
$.getJSON(url, { \'un
I'm having it too, and it's exactly the same: my Node.js application serves Ajax requests and no matter which /url
I request it's either 30ms
or 300ms
and it switches back and forth: odd requests are long, even requests are short.
The thing I see in Chrome Web Inspector (aka Chrome DevTools) is that there is a long gap between "DNS lookup" and "Initial Connection".
They say it's OCSP
related here:
http://www.webpagetest.org/forums/showthread.php?tid=12357
OCSP is some kind of certificate validation protocol: https://en.wikipedia.org/wiki/Online_Certificate_Status_Protocol
Moving from localhost
to 127.0.0.1
seems to fix it: response times are 30ms
now.
I've run into this also. It only seems to happen when using localhost. If you use 127.0.0.1 (or even the computer name), it will not have the extra delay.