duanli6618 2011-09-07 02:40
浏览 28
已采纳

在这些情况下,我应该如何限制我的ajax使用?

I'm constructing a social networking website and I'm currently testing Ajax on certain features.

Right now, I have 3 separate calls coming from my include (which is on every page) that will check the database for new messages, achievements, and notifications and update the specific divs.

My biggest worry is that 3 separate calls would eventually lead to performance issues.

I have no way of really seeing how a large user-base would affect this, because my site is currently in beta and I haven't advertised yet. So I have a limited number of people to test with. When I do advertise and gain more members, I don't want to run into any hiccups.

I currently have the calls being made every 20 seconds. I was hoping someone could give me some advice on how long I should set the intervals. I have no way of currently knowing if 20 seconds would be too much, or if I could even set it to 10 and be fine.

Any advice would be appreciated. Thanks.

  • 写回答

1条回答 默认 最新

  • dongtangjie0495 2011-09-07 02:46
    关注

    Perhaps you should look into server push to push the data to the client when there are new messages and so on. That means that instead of polling using resources, resources are only used when there are new messages and pushed to the client.

    Some server push servers are:

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 模电中二极管,三极管和电容的应用
  • ¥15 关于模型导入UNITY的.FBX: Check external application preferences.警告。
  • ¥15 气象网格数据与卫星轨道数据如何匹配
  • ¥100 java ee ssm项目 悬赏,感兴趣直接联系我
  • ¥15 微软账户问题不小心注销了好像
  • ¥15 x264库中预测模式字IPM、运动向量差MVD、量化后的DCT系数的位置
  • ¥15 curl 命令调用正常,程序调用报 java.net.ConnectException: connection refused
  • ¥20 关于web前端如何播放二次加密m3u8视频的问题
  • ¥15 使用百度地图api 位置函数报错?
  • ¥15 metamask如何添加TRON自定义网络