对于用作可扩展 TCP 服务器基础的组件有什么建议吗?我目前有一个使用 Indy 的实现,它适用于 100 个相对活跃的连接或 1,000 个相对不活跃的连接,但每个连接一个线程模型限制了可以处理的并发事件连接的数量。
假设我的目标可能是在一台好的服务器(8-16 核)上有 1,000 个连接,每个连接每秒处理 10 条消息,或者 10,000 个连接,每个连接每秒处理 1 条消息。这现实吗?我真的很想听听任何现实世界的实现,因为我发现理论上可行的方法在实践中不一定可行,而且我不想追求一个行不通的建议解决方案。
编辑: IOCP 会很好,但我只想使用商业级类/组件,因此它们需要像 Indy 或 IP*Works 一样“专业”,然后我才会想到使用它们。此外,我无意“推出自己的”解决方案 - 使其成为商业级需要太多时间。最后,我正在寻求对我已有的东西进行重大改进。我确信我可以从我所拥有的资源中挤出至少 20-50%(基于 Indy),但无论我多么努力,我永远无法处理 10,000 个并发客户端,或每秒 10,000 条消息。是否存在满足这些条件的东西是另一回事。
我决定接受有关 IOCP 类的答案,尽管我没有使用过它们,因为它们看起来是现阶段调查的最佳路径。
最佳答案
有一个project在http://voipobjects.com/这是基于前者 iopcclasses项目。
它声称可以处理数千个并发连接:
IOCP engine is set of classes, components and routines for rapid creation high scalable and performance TCP/UDP applications. Application created using IOCP classes can handle thousands simultaneous connections.
Library is written in Delphi - Delphi 7 - 2010 are supported.
Library uses IO completion ports technology. There is most powerful technology in Win32 world for creation highly scalable and performance TCP/UDP applications. This technology is supported in all desktop Windows OSes except old Win9x/WinME versions.
This library is licensed under MPL1.1. Also It includes some files from Jedi project (Winsock2 header translation).
关于delphi - 可扩展的 Delphi TCP 服务器实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7150093/