HTML5 websockets:最大打开连接数? [英] HTML5 websockets: max number of open connections?

查看:172
本文介绍了HTML5 websockets:最大打开连接数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTML5 websockets(并且已经有一段时间了)是一个热门话题,因为它们优雅地启用实时 服务器端推送

HTML5 websockets are (and have been for some time) a hot topic as they elegantly enable real-time server-side push.

我目前有一个工作应用程序,其中包含由Tomcat 7.0.30提供支持的websockets,其中包括 websocket support 。但是将其转移到生产环境会产生问题。

I currently have a working application with websockets powered by Tomcat 7.0.30 which includes websocket support. But moving this to a production environment raises questions.

主要是我想知道可以运行的最大连接数( open )同时按浏览会话; 浏览会话意味着单个浏览器选项卡或窗口。

Mainly I would like to know the possible maximum number of connections that can operate (be open) concurrently per browsing session; a browsing session implies a single browser tab or window.

开放的websocket连接是否可以同时处理可以同时处理的最大连接数通过Web服务器?例如。 MaxClients 在Apache中。

Do open websocket connections add up to the maximum number of connections that can be processed simultaneously by the Web server? E.g. MaxClients in Apache.

相反,浏览器本身限制的单个浏览会话的最大websockets数是多少?正如博客文章所示,截至2012年4月,不同的浏览器支持不同数量的打开 websocket连接。 (我个人的目标是每个浏览会话1个开放的websocket ;但这个信息仍然很好知道。)

Conversely, is the maximum number of websockets for a single browsing session limited by the browser itself? As this blog post shows, up to April 2012, different browsers support varying amounts of open websocket connections. (I personally would aim for 1 open websocket per browsing session; but this info would still be good to know).

TL / DR:


  1. 每个浏览会话可能的websockets数量限制了什么?是客户吗?服务器?或两者兼而有之?

  2. 同样的限制适用于 ws: wss : connections?

  1. What limits the amount of possible websockets per browsing session? Is it the client? The server? Or a combination of both?
  2. Does the same limitation(s) apply to both ws: and wss: connections?


推荐答案

没有标准规范浏览器的 max-connections 默认值。它取决于实现[0]。此外,对于同一个应用程序,每个浏览会话使用多个Web套接字似乎有点过分,因为您可以使用发布/订阅频道。

There isn't a standard specification of max-connections default value for browsers.It depends on implementation [0]. Furthermore using more than a web-socket per browsing session for the same application seems overkill since you can use pub/sub channels.

瓶颈连接通常在服务器端。 Web套接字是对HTTP的升级,因此连接只是升级HTTP(TCP)连接[1] .HTTPS和WSS只为正常连接添加了一个安全层。它们不是一个不同的连接[2]。在您的情况下,请检查 maxConnections (和 maxThreads )[3]和您的操作系统最大值[4] [5]。如果您的并发连接数达到数万,那么您应该开始考虑负载平衡或群集[6]。

Bottleneck for connections usually is at server side. Web-socket is a upgrade to HTTP so connections are "just" upgraded HTTP(TCP) connections [1].HTTPS and WSS add just a security layer to the normal connection.They are not a different connection [2]. In your case check maxConnections (and maxThreads) [3] and your Operating System maximums [4][5]. If your concurrent connections reach tens of thousands maybe you should start thinking on load balancing or clustering [6].

[0] https://code.google.com/p/chromium/issues/detail?id=85323

[1] http://en.wikipedia .org / wiki / WebSocket

[2] http://en.wikipedia.org/wiki/HTTP_Secure

[3] http://tomcat.apache.org/tomcat-7.0-doc/config/http.html

[4] https://serverfault.com/questions/10852/what-limits-the-maximum-number-of-connections-on-a-linux-server

[5] https://superuser.com/questions/251596/is-there-a-hard-limit-of-65536-open-tcp-connections-per- ip-address-on-linux

[6] http://tomcat.apache.org/tomcat-7.0-doc/config/cluster.html

有关高并发性的更多信息: http://www.kegel.com/c10k.html

More about high concurrency: http://www.kegel.com/c10k.html

这篇关于HTML5 websockets:最大打开连接数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆