可扩展的 Delphi TCP 服务器实现 [英] Scalable Delphi TCP server implementation

查看:23
本文介绍了可扩展的 Delphi TCP 服务器实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于用作可扩展 TCP 服务器基础的组件有什么建议吗?我目前有一个使用 Indy 的实现,它适用于 100 个相对活跃的连接或 1000 个相对不活跃的连接,但每个连接模型的一个线程限制了可以处理的并发活动连接的数量.

Any suggestions for components to use as a base for a scalable TCP server? I currently have an implementation that uses Indy which works well for say 100 relatively active connections or 1,000 relatively inactive connections, but the one thread per connection model limits the number of concurrent active connections that can be handled.

假设我的目标可能是 1,000 个连接,每个连接每秒处理 10 条消息,或者 10,000 个连接,每个连接每秒在一个好的服务器(8-16 核)上处理 1 条消息.这是现实的吗?我真的很想听听任何现实世界的实现,因为我发现理论上可行的方法在实践中不一定可行,而且我不想追逐一个行不通的提议解决方案.

Let's say my goal might be 1,000 connections each processing 10 messages per second or 10,000 connections each processing 1 message per second on a good server (8-16 cores). Is this realistic? I'd really like to hear of any real-world implementations because I have found that what might work in theory does not necessarily work in practice and I do not want to be chasing a proposed solution that will not work.

IOCP 会很好,但我只想使用商业级的类/组件,所以在我想到之前,它们需要像 Indy 或 IP*Works 一样专业"使用它们.此外,我无意推出我自己的"解决方案 - 使其商业级需要太多时间.最后,我正在寻找对我已经拥有的东西的重大改进.我确信我可以从我所拥有的(基于 Indy)中挤出至少 20-50%,但我永远无法处理 10,000 个并发客户端,或每秒 10,000 条消息,无论我多么努力.是否有满足这些条件的东西是另一回事.

IOCP would be good, but I only want to use commercial-grade classes/components, so they need to be as "professional" as Indy or IP*Works before I would think of using them. Furthermore, I have no intention of "rolling my own" solution - it would take too much time to make it commercial-grade. Lastly, I am looking for a significant improvement on what I already have. I am sure I can squeeze at least 20-50% more out of what I have (based on Indy), but I am never going to be able to handle 10,000 concurrent clients, or 10,000 messages per second, no matter how hard I try. Whether there is something out there that meets these conditions is another matter.

我决定接受关于 IOCP 类的答案,即使我没有使用它们,因为它们看起来是现阶段调查的最佳途径.

I have decided to accept the answer referring to the IOCP classes, even though I have not used them, because they look like the best path for investigation at this stage.

推荐答案

有一个项目http://voipobjects.com/ 上,它基于前者 iopcclasses 项目.

There is a project at http://voipobjects.com/ which is based on the former iopcclasses project.

它声称可以处理数千个同时连接:

IOCP 引擎是一组类、组件和例程,用于快速创建高可扩展性和性能的 TCP/UDP 应用程序.使用 IOCP 类创建的应用程序可以处理数千个同时连接.

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.

库是用 Delphi 编写的 - 支持 Delphi 7 - 2010.

Library is written in Delphi - Delphi 7 - 2010 are supported.

库使用 IO 完成端口技术.有最强大的Win32 世界中的技术,用于创建高度可扩展和性能TCP/UDP 应用程序.所有桌面都支持此技术除旧版 Win9x/WinME 外的 Windows 操作系统.

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.

该库在 MPL1.1 下获得许可.它还包括一些文件来自绝地项目(Winsock2 标头翻译).

This library is licensed under MPL1.1. Also It includes some files from Jedi project (Winsock2 header translation).

https://bitbucket.org/voipobjects/iocpengine

这篇关于可扩展的 Delphi TCP 服务器实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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