COMET 相对于长请求轮询的优势?

发布于 2024-07-20 15:26:09 字数 234 浏览 1 评论 0原文

我一直想知道使用 COMET / 推送技术是否比使用长请求进行更简单的轮询是否有真正的优势,在长请求中,服务器将等待一定的最长时间以等待新事件发生,然后再告诉客户端没有发生任何事情。

两种技术都有相似的客户端延迟,虽然普遍认为长请求会更糟糕,因为它们需要建立新的连接,但事实上还有 HTTP keep-alive - 所以最终,两者似乎产生了非常相似的结果流量/负载量。

那么使用 COMET 有什么明显的优势吗?

I've been wondering if there is a real advantage to using COMET / push-technologies over the much simpler polling with long requests where the server will wait a certain maximum time for new events to happen before telling the clients that nothing happened.

Both technologies have similar client latencies and while common wisdom is that long requests are worse because they need to establish a new connection, there's also the fact that there is HTTP keep-alive -- so in the end, both seem to produce a very similar amount of traffic / load.

So is there some clear advantage to using COMET?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

残疾 2024-07-27 15:26:09

据我所知,长请求的民意调查几乎是彗星。 短请求轮询则不然。

AFAIK polling with long requests pretty much IS comet. Polling with short requests is not.

染火枫林 2024-07-27 15:26:09

我能想到的一些优点:

  • 使客户端编程更容易。
  • 真实事件和通知到达客户端之间的最小延迟。 对于轮询,平均时间为 [POLL TIME]/2,最坏情况为 [POLL TIME]。
  • 可以最大限度地减少服务器所需的资源。 例如,请参阅这篇文章。 要实现这一点,需要使用新的服务器技术。

Some advantages I can think of:

  • Makes client programming easier.
  • Minimum latency between the real event and the notification reaching the client. With polling this has a mean time of [POLL TIME]/2 and a worst case of [POLL TIME].
  • Can minimize the resources needed in the server. See this article for example. New server technologies need to be used for this to happen.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文