WebSocketsPP v3库的客户端连接限制 [英] Client connection limit for WebSocketsPP v3 library

查看:206
本文介绍了WebSocketsPP v3库的客户端连接限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WebSocket ++ 0.3.x库中,什么决定了有多少个WebSocket客户端可以有活动连接的限制?是每个线程一个连接,还是一个线程可以处理多个WebSocket客户端连接?如果是后者,那么大约一个线程可以拥有多少个连接?

In the WebSocket++ 0.3.x library, what determines the limit of how many WebSocket clients can have an active connection? Is it one connection per thread, or can one thread handle multiple WebSocket client connections? If it is the latter, roughly how many connections can one thread hold?

基本上,我正在寻找一个ballpark数量的WebSocket ++库可以处理多少客户端连接一个大约有25个线程的应用程序。图书馆的首页是:
http://www.zaphoyd.com/websocketpp

Basically, I'm looking for a ballpark number of how many client connections WebSocket++ library can handle in a application with roughly 25 threads to spare. The library homepage is: http://www.zaphoyd.com/websocketpp

推荐答案

如果您在支持非阻塞/异步I的平台上使用基于Boost.Asio的传输策略和最新版本的Boost / O(Linux上的epoll,OS X / BSD上的kqueue,Windows上的iocp),那么WebSocket ++不会对并发连接带来任何显着的限制。

If you are using the Boost.Asio based transport policy with a recent version of Boost on a platform that supports non-blocking/asynchronous I/O (epoll on Linux, kqueue on OS X/BSD, iocp on Windows) then WebSocket++ does not introduce any significant limits on simultaneous connections.

在这种情况下,限制基本上基于操作系统,硬件和应用程序因素。操作系统将限制每个进程使用的总文件描述符(使用根访问权限可以更改此限制)。高并发级别将要求您的应用程序被适当地构造以处理它(主要使用短,有界时间,非阻塞处理程序)。其他因素将限制您,就像通用服务器将受到限制一样。千兆以太网只能处理这么多的流量,使用TLS或压缩会降低性能等。

In such situations, the limits are pretty much based on OS, hardware, and application factors. The OS will limit total file descriptors in use per process (with root access this limit can be changed). High concurrency levels will require your application to be structured appropriately to handle it (primarily using short, bounded time, non-blocking handlers). Other factors will limit you in the same way that generic servers will be limited. Gigabit Ethernet can only handle so much traffic, using TLS or compression will reduce performance, etc.

我还没有做过广泛的性能基准0.3.x,但0.2 .x在适当调优的应用程序中能够轻松地在i7内核上服务成千上万的并发客户端。

I haven't done extensive performance benchmarking with 0.3.x yet, but 0.2.x in appropriately tuned applications were able to easily service 10s of thousands of concurrent clients on an i7 core.

这是WebSocket ++体系结构扩展到任意连接计数得到足够的资源。如果你正在使用一个应用程序来扩展WebSocket ++超过10k的连接,我会有兴趣更多的细节,并解决你发现的任何瓶颈。

It is the intention of the WebSocket++ architecture to scale to arbitrary connection counts given sufficient resources. If you are working on an application that scales WebSocket++ beyond 10k connections I'd be interested in more details and in addressing any bottlenecks you discover.

这篇关于WebSocketsPP v3库的客户端连接限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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