开发者

Polite frequency of AJAX requests?

I'm writing a script that makes an AJAX request at regular intervals. The request loads a开发者_开发技巧 remote page and pulls some numbers from it. The page is public, so the script does the equivalent of refreshing the page every few minutes.

It's possible (although unlikely) that this script will be used by hundreds (maybe thousands) of users if I release it.

Is there a rule of thumb or generally accepted polite frequency of requests that I should adhere to?


For an RRS reader, a minute is good as refresh interval. For a chat (with very few users), I used 5 seconds. It depends the use of your script.


You should always cache the page on your own server if possible.

In general though, avoid loading remote pages unless you absolutely need to. The resource cost is high on both your and their end.

A "polite" frequency for things like search-engine spiders is one request per second. of course, if it is a service like google, they can be more frequent, but keep them as low as possible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜