每个服务器的套接字连接的实际/硬限制是什么 [英] What is the practical / hard limit on socket connections per server

查看:39
本文介绍了每个服务器的套接字连接的实际/硬限制是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多客户端设备打开由运行在 Windows 2008 R2 服务器上的服务公开的套接字连接.我想知道并发客户端连接数是否有硬限制.

I have a number of client devices that open socket connection exposed by a service running on a Windows 2008 R2 server. I'm wondering if what is hard limit on the number of concurrent client connections.

推荐答案

假设您为服务器选择了合理的架构,那么限制将与内存和 CPU 相关.恕我直言,你永远不会达到马丁提到的硬限制:)

Assuming you select a sensible architecture for your server then the limit will be memory and cpu related. IMHO you'll never reach the hard limit that Martin mentions :)

因此,与其担心永远不会达到的理论限制,恕我直言,不如考虑如何设计应用程序以及如何测试它以确定当前可以使用的最大客户端连接数在给定的硬件上为您的应用程序维护.对我来说重要的是从第 0 天开始运行性能测试(请参阅 此处 用于我解释这一点的博客文章).现代操作系统和硬件允许您构建非常可扩展的系统,但简单的日常编码和设计错误很容易浪费这种可扩展性,因此您必须始终运行性能测试,以便您知道何时构建障碍表现.您根本无法在项目结束时返回并修复此类错误.

So, rather than worrying about a theoretical limit that you'll never hit you should, IMHO, be thinking about how you will design your application and how you will test it to determine the current maximum number of client connections that you can maintain for your application on given hardware. The important thing for me is to run your perf tests from Day 0 (see here for a blog posting where I explain this). Modern operating systems and hardware allow you to build very scalable systems but simple day to day coding and design mistakes can easily squander that scalability and so you simply MUST run perf tests all the time so that you know when you are building in road blocks to your performance. You simply cannot go back and fix these kind of mistakes at the end of the project.

顺便说一句,我在具有低规格虚拟机的 Windows 2003 Server 上运行了一些测试,并且使用基于重叠 I/O(I/O 完成端口)的设计的简单服务器轻松实现了超过 70,000 个并发和活动连接.有关详细信息,请参阅此答案.

As an aside, I ran some tests on Windows 2003 Server with a low spec VM and easily achieved more than 70,000 concurrent and active connections with a simple server based on an overlapped I/O (I/O completion port) based design. See this answer for more details.

我个人的方法是使用您决定的任何技术快速组装服务器的外壳(我喜欢使用 I/O 完成端口和最少线程的非托管 C++),请参阅 这篇博文 了解更多详情.然后构建一个客户端或一系列客户端,它们可以对应用程序进行压力测试,并在实现服务器逻辑时不断更新和运行测试客户端.随着您向服务器添加更多复杂性,您可能会看到最大并发客户端的曲线逐渐下降;可扩展性的大幅下降应该会导致您检查最新的签入以寻找不幸的设计决策.

My personal approach would be to get a shell of a server put together quickly using whatever technology you decide on (I favour unmanaged C++ using I/O Completion Ports and minimal threads), see this blog posting for more details. Then build a client or series of clients that can stress test the application and keep updating and running the test clients as you implement your server logic. You would expect to see a gradually declining curve of maximum concurrent clients as you add more complexity to your server; large drops in scalability should cause you to examine the latest check ins to look for unfortunate design decisions.

这篇关于每个服务器的套接字连接的实际/硬限制是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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