Reputation: 3016
I wrote a small script (with jQuery for AJAX) to "ping" the server and output how long it takes for my AJAX requests to occur.
var start = Date.now(), end = 0;
setInterval(function() {
$.ajax('', {
complete: function() {
end = Date.now();
console.log(end - start);
}
});
}, 1000);
This is the kind of pattern I'm getting:
39
2
4
2
3
40
3
2
3
4
2
61
9
4
3
2
2
4
34
etc.
Why does the "ping" jump from a low number (2, 3, 4, etc.) to a higher one (40, 50, 60) in such a pattern? Is there an obvious reason or should I just blame it on HTTP/AJAX technology?
Upvotes: 1
Views: 121
Reputation: 1038
Those requests with about 40ms in your example are real requests. Others are cached results by browser.
Upvotes: 3