Ruby TCP:有基准吗?
我有一个远程服务器,需要能够在特定端口上接受来自客户端的多个同时连接。我需要快速可靠的连接。
我计划在远程端使用 TCPServer,在客户端使用 TCPSocket。可能有 200 多个到服务器的连接。
对于这样的系统,我们有任何已知的 Ruby 基准测试吗? 另外,我是否需要担心套接字级别的底层数据复用,或者 Ruby/OS 库会处理同样的问题吗?
最后,你们能给我推荐一些讨论这样的系统设计的具体链接/书籍吗?我用谷歌搜索了一下,但有关 Ruby 网络的书籍似乎很奇怪。
I have a remote server that needs to be able to accept multiple simultaneous connections from clients on a specific port. I need the connections to be fast and reliable.
I am planning to use TCPServer on the remote side and TCPSocket on the client side. There'd likely be 200+ connections to the server.
Do we have any known benchmarks in Ruby for a system like this?
Also, do I need to worry about the underlying data multiplexing at socket level or Ruby/OS libraries take care of the same?
Finally, will you folks be able to recommend me any specific links/books that talk about designing systems like this? I googled but books about networking in Ruby seem to be an oddity.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
多客户端 TCP 服务器通常为每个客户端创建一个单独的线程。因此,它可以处理机器/操作系统允许的尽可能多的连接。此限制由内核管理。因此,就基准测试而言,它实际上取决于机器的性能。
以下是 Ruby 套接字编程的一些示例/教程的链接:
A multi-client TCP server generally creates a separate thread for each client. Therefore, it can handle as many connections as the machine/OS will allow. This limitation is managed by the kernel. So, as far as benchmarks go, it really depends on the performance of your machine.
Here is a link to some examples/tutorials for Ruby Socket Programming:
我认为你最好利用 EventMachine。它应该非常快速和高效。
编辑:看看:
this 和 这个
I think you would be better off leveraging EventMachine. It should be pretty fast and efficient.
EDIT: have a look at:
this and this