LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-13-2018, 01:01 AM   #1
premp
LQ Newbie
 
Registered: Jul 2018
Posts: 1

Rep: Reputation: Disabled
UDP packet latency.


Hello,

I have two applications that exchange UDP datagrams. For the most part, the receiving application is able to get data via the recvfrom() call without any delay. Occasionally, I see that although the sender (using write() into socket fd) sends the data, there is a considerable amount of delay (~100 msec) before the receiver sees the data (Polling via recvfrom()).

I would like to get few pointers/hints so I can debug this.

Questions:

1. I noticed that /proc/net/udp shows a snapshot of the sockets with the rx/tx queues. Is the data flow below accurate?

sender user space buffer -> Kernel UDP tx buffer -> Kernel UDP rx buffer -> receiver user space buffer.

I'd like to know if I can debug the latency issue just by relying on monitoring the rx/tx queues in /proc/net/udp. Is there any other way I can do this?

2. I have verified that the sender and receiver threads are not starved of CPU time. Given this, is there anything else that is likely to cause the data to not show up on the receiver socket?

Any hints/directions you can give will be helpful. Thanks for reading.
 
Old 07-13-2018, 03:30 PM   #2
slizotteK
LQ Newbie
 
Registered: Jul 2018
Posts: 3

Rep: Reputation: Disabled
Hi premp,

I'm observing exactly the same problem, in my case, I'm using sendto(), poll() and recv() on 8 sockets to exchange request/reply every 1 milliseconds. Randomly I'm observing a reply being delayed 100 milliseconds only on one socket, all other sockets are receiving reply normally meanwhile. I did also reproduce the problem using only one socket.

Additional tests shown that sending a request and receiving the reply pushes the old reply out of the socket, but the new reply is not received and again waits for the next reply to come in for a period of 100 milliseconds then the situation goes back to normal on that socket.

Last edited by slizotteK; 07-13-2018 at 05:27 PM. Reason: Addtional Information
 
Old 07-16-2018, 03:43 PM   #3
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
Quote:
sender user space buffer -> Kernel UDP tx buffer -> Kernel UDP rx buffer -> receiver user space buffer.
Do you do look-back on same machine?
 
Old 07-16-2018, 03:47 PM   #4
slizotteK
LQ Newbie
 
Registered: Jul 2018
Posts: 3

Rep: Reputation: Disabled
No we are exchanging messages with 8 external IP devices on the same Ethernet bus.
 
Old 07-17-2018, 02:37 PM   #5
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
Basically, Linux OS isn't real time OS. So you can't expect that Linux always response as soon as possible, most time is fine.
 
Old 07-17-2018, 02:42 PM   #6
slizotteK
LQ Newbie
 
Registered: Jul 2018
Posts: 3

Rep: Reputation: Disabled
There is something that blocks the reception of the buffer in the socket that is pushed by the next reply, I do not believe this has nothing to do with the real-time nature of Linux.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux IPef UDP Test Find Latency Question danmartinj Linux - Networking 1 08-11-2015 02:48 PM
[SOLVED] Latency increases when we increase the packet size. srijivdimri Linux - Newbie 9 01-31-2014 08:05 PM
[SOLVED] receiving UDP packets - where does the latency come from? mibo Programming 5 06-22-2011 10:33 AM
UDP packet oss dazdaz Linux - Networking 2 04-05-2004 01:30 PM
iptables udp latency wazza2001 Linux - Security 1 09-03-2001 08:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration