HTTP 推送超过 100,000 个连接
我想使用客户端-服务器协议将数据推送到始终保持连接的客户端,24/7。
HTTP 是一个很好的通用客户端-服务器协议。我不认为任何其他协议的语义可能有很大不同,并且存在许多好的 HTTP 服务器。
关键因素是连接数量:应用程序将逐渐扩展到大量客户端,例如 100,000 个。它们不能成为服务器,因为它们具有动态 IP 地址并且可能位于防火墙后面。因此,必须建立并保留套接字链接,这将导致我们进行 HTTP 推送。数据实际上很少会被推送到给定的客户端,因此我们也希望最大限度地减少连接开销。
服务器应通过接受连接、将远程 IP 和端口插入表中并使其空闲来处理此问题。我们不希望运行 100,000 个线程,只希望运行如此多的表条目和文件描述符。
有没有办法使用现成的 HTTP 服务器来实现此目的,而无需在套接字层进行写入?
I want to use a client-server protocol to push data to clients which will always remain connected, 24/7.
HTTP is a good general-purpose client-server protocol. I don't think the semantics possibly could be very different for any other protocol, and many good HTTP servers exist.
The critical factor is the number of connections: the application will gradually scale up to a very large number of clients, say 100,000. They cannot be servers because they have dynamic IP addresses and may be behind firewalls. So, a socket link must be established and preserved, which leads us to HTTP push. Only rarely will data actually be pushed to a given client, so we want to minimize the connection overhead too.
The server should handle this by accepting the connection, inserting the remote IP and port into a table, and leaving it idle. We don't want 100,000 threads running, just so many table entries and file descriptors.
Is there any way to achieve this using an off-the-shelf HTTP server, without writing at the socket layer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用推送框架:http://www.pushframework.com。
它是为管理大量长期异步全双工连接的目标而设计的。
Use Push Framework : http://www.pushframework.com.
It was designed for that goal of managing a large number of long-lived asynchronous full-duplex connections.
LightStreamer(http://www.lightstreamer.com/)是专门针对HTTP的PUSH操作而制作的工具。
它应该解决这个问题。
LightStreamer (http://www.lightstreamer.com/) is the tool that is made specifically for PUSH operations of HTTP.
It should solve this problem.
您还可以查看 Jetty + Continuations。
You could also look at Jetty + Continuations.