开发者

What is the optimal refresh period if I know I'll have new backend data coming in every minute?

开发者 https://www.devze.com 2023-02-10 12:58 出处:网络
I have data in a backend server that is updated every minute.I\'m writing a client that will fetch this data periodically via AJAX, and am wondering how often the client should request new data.

I have data in a backend server that is updated every minute. I'm writing a client that will fetch this data periodically via AJAX, and am wondering how often the client should request new data.

Common sense says a minute, but in the case when a client initially connects 10 seconds before a data refresh, it is left looking at st开发者_高级运维ale data for 50 seconds. My gut tells me that I should refresh every 30 seconds because if a train comes every 10 minutes, the average wait time is 5 minutes. It feels related to me, but could very well not be.

I realize going less than the update period will put more stress on the backend, but I'm hoping there can be a happy medium.


Once a minute sounds right to me. But if seeing "stale" data for 50 seconds is a major concern, then perhaps you need it more frequently in your case.

0

精彩评论

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