使用C ++ Builder XE2中的Indy框架10通过TCP / IP流式传输数据,性能问题。 [英] Streaming data via TCP/IP using Indy framework 10 in C++Builder XE2, performance issue.

查看:67
本文介绍了使用C ++ Builder XE2中的Indy框架10通过TCP / IP流式传输数据,性能问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello world,



我想在我的应用程序中通过TCP / IP向客户提供USB测量模块的测量数据。

我必须使用集成了Indy 10的C ++ Builder XE2。我使用Indy的IdTCPServer类来建立服务器。测量数据被写入缓冲区。 IdTCPServer类提供了一个在单独的线程中处理的执行方法,该方法由IdTCPServer对象管理。我使用这种方法从缓冲区获取数据并将其发送到连接的客户端。



数据转发已经过测试并且有效,但存在性能问题。 br />
有时我可以在1.5毫秒内发送11264字节,有时发送时间增加到60毫秒。我将数据从服务器应用程序发送到ncat客户端时测量时间,这两者都在我的计算机上执行。我当时没有使用网络进行任何其他操作(除了outlook-sync之外)。



有没有人知道我应该在哪里寻找它为什么像这样增加?



谢谢。

Hello world,

I want to provide measurement data of an USB-measurement-modul to clients via TCP/IP in my application.
I have to use C++Builder XE2 where Indy 10 is integrated. I use the IdTCPServer class of Indy to establish the server. The measurement data is written into a buffer. The IdTCPServer class provides an execute method that is handled in a separate thread and that is administered by the IdTCPServer-object. I use this method to get data from the buffer and send it to the connected client.

The data forwarding was tested and works, but there is an performance issue.
Sometimes I can send 11264 bytes in 1.5 ms and sometimes the sending time increases to 60 ms. Time was measured when I send the data from the server-application to a ncat-client, both executed on my computer. I did not use the network for anything else in that time (except of outlook-sync maybe).

Does anyone have an idea where I should look for why it is increasing like this?

Thank you.

推荐答案

实际上并没有那么多数据,所以你的操作系统可能是缓冲数据并等待稍后传输(如果还有更多)。



检查你的MTU大小(可能在1500字节范围内)并且可能尝试将该大小减小到一些小的(在Linux中,您可以运行 sudo ifconfig eth#mtu 400 )。如果将其更改为某个小值有帮助,那么它确认您的操作系统正在缓冲数据并在传输数据之前将其保留一段,以最大限度地提高传输效率。这只是处理TCP / IP流的本质。
That's actually not that much data, so your OS is probably buffering data and waiting to transmit that at a later time (in case there's more to come).

Check your MTU size (likely in the 1500 bytes range) and perhaps try reducing that size to something small (in Linux you can run sudo ifconfig eth# mtu 400 for example). If changing that to some small value helps, well it confirms that your OS is buffering data and holding it for a bit before transmitting it to maximize transmit efficiency "on the wire". That's just the nature of dealing with TCP/IP streams.


这篇关于使用C ++ Builder XE2中的Indy框架10通过TCP / IP流式传输数据,性能问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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