Indy的TCPServer到底能支持多少个连接
zkfly 2006-03-18 06:11:48 最近一个项目,最开始使用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服务器的,你们的服务器可以连接多少客户端呀?