Indy的TCPServer到底能支持多少个连接
最近一个项目,最开始使用IdTcpServer,在大压力测试的时候,只连接了800个多一点的客户端(每个客户端连接上之后每秒钟发送一个几十字节的报文,服务器应答)。但是持续的时间不会超过10分钟,服务器就会挂掉(经常是服务器突然关闭消失,任何提示都没有)。后来优化了互斥量之后,可以连接到1000多个客户端。但是服务器消失的问题依然存在。
今天再一台双CPU,4G内存的服务器上试验了下,居然最也只能连接到2000多个客户端。然后换了Indy10.1.5服务器只做简单的连接和应答,客户端连接之后只发送一个报文,还是一样,服务器最多只能连接2000多个客户端。
然后下载了Indy10的官方帮助文件(http://www.projectindy.org/downloads/IndyDocs_10.1.5.0_HtmlHelp.zip)它的TCPServer帮助里面有一段话:
But there are performance and resource limitations imposed by the platform or Operating System on the number of threads that can be created. On Windows, for example, the number of threads is limited by the available virtual memory. By default, every thread gets one megabyte of stack space and implies a theoretical limit of 2028 threads. Reducing the default stack size will allow more threads to be created, but will adversely impact system performance.
意思理论上Windows的操作系统最多支持2028个线程。于是昏倒了。因为我们的客户端最少也会有5000个呀。
后来有换了delphi的异步非阻塞TCPServer,测试连接了15000个客户端都没有啥问题。
难道Indy真的只能支持到2000多个客户端连接?
各位大侠有用过Indy的TCP服务器的,你们的服务器可以连接多少客户端呀?
今天再一台双CPU,4G内存的服务器上试验了下,居然最也只能连接到2000多个客户端。然后换了Indy10.1.5服务器只做简单的连接和应答,客户端连接之后只发送一个报文,还是一样,服务器最多只能连接2000多个客户端。
然后下载了Indy10的官方帮助文件(http://www.projectindy.org/downloads/IndyDocs_10.1.5.0_HtmlHelp.zip)它的TCPServer帮助里面有一段话:
But there are performance and resource limitations imposed by the platform or Operating System on the number of threads that can be created. On Windows, for example, the number of threads is limited by the available virtual memory. By default, every thread gets one megabyte of stack space and implies a theoretical limit of 2028 threads. Reducing the default stack size will allow more threads to be created, but will adversely impact system performance.
意思理论上Windows的操作系统最多支持2028个线程。于是昏倒了。因为我们的客户端最少也会有5000个呀。
后来有换了delphi的异步非阻塞TCPServer,测试连接了15000个客户端都没有啥问题。
难道Indy真的只能支持到2000多个客户端连接?
各位大侠有用过Indy的TCP服务器的,你们的服务器可以连接多少客户端呀?
...全文
相关推荐
indy10TcpServer 与client示例ListView版.rar
Indy是一个功能强大的网络通信组件集,支持多种协议,如TCP/IP、UDP、HTTP、FTP等。在这个ListView版的示例中,它将展示如何在界面上使用ListView控件来显示和管理连接信息。
delphi TCPSERVER 源代码
这可能意味着源代码不仅处理了基本的 TCP 连接,还可能支持了 HTTP 功能,例如提供 Web 服务或 API 接口。
Indy控件在C/S模式下通讯示例(delphi 源码)
Indy控件是Delphi开发网络应用程序时常用的一组组件库,它提供了丰富的网络协议支持,包括TCP、UDP、HTTP、FTP等。
从Indy9升级到Indy10时IdTcpServer的变化
组件结构的分割与重构在Indy9.18中,TcpServer组件的功能较为集中,但在Indy10中,它被细分为两个独立的组件:TIdCmdTCPServer和TIdTCPServer。
Delphi 中TcpServer和TcpClient用法
此外,文中还提到了 Indy 10 支持的纤维(Fiber)API,这是一种轻量级的线程处理技术,可以提高服务器端的性能,尤其是在处理大量并发连接时。


网络通信/分布式开发
