2011-10-18 61 views
2

在我的應用程序中,我通過UDP套接字以約58MB /秒的速率發送數據。大多數時候它工作正常,但是有時sendto持續時間過長,時間大約分0.1,0.2,0.3秒(見下圖)。 我的系統是一個內核爲2.6.32-24-linux的linux系統,每個發送的緩衝區長度爲45000字節。你是否知道爲什麼會發生這種情況?udp sendto持續時間過長(不尋常的時間)

http://i54.tinypic.com/iyfv9e.png

+0

你用RT內核試過了嗎? –

回答

1

從發送(2): 比這個內核可能會做一些在此期間,其他When the message does not fit into the send buffer of the socket, send() normally blocks, unless the socket has been placed in nonblock‐ ing I/O mode. In nonblocking mode it would fail with the error EAGAIN or EWOULDBLOCK in this case. The select(2) call may be used to deter‐ mine when it is possible to send more data.

其他。如果是這種情況,使用RT內核可能會有所幫助,如yi_H所示。

+0

對我來說奇怪的是爲什麼0.1,0.2,0.3等 –

+0

也是十分之一秒是可怕的很長時間的網絡......你怎麼發送數據?它是平均發送還是以連發發送?發送緩衝區可以滿嗎? 100Mb/1Gb/..卡? –

+0

這是平均的,我們有1Gb卡,我們已經升級到2.6.38-10更厚(前一個2.6.32-24不是),現在我們無法複製這個問題。 –