How to speed up ReceiveNetworkData()
Posted: Thu Sep 23, 2021 3:18 pm
Hi
I created several micro services in PB Linux that all run on the same PC so no network is involved. They communicate via sending strings back and forth over TCP connections. I noticed that most of the services receive and send responses almost immediately. I did notice there were times when delays occurred. So upon further debugging I discovered that SendNetworkString is never more than 1ms but the ReceiveNetworkData function times vary quite widely from say 20 ms to 3.5 seconds for the same command. Since this is all happening in memory and the data transferred is usually less than a 2kb I wonder why the ReceiveNetworkData is so slow. I thought about changing the TCP_NODELAY or about using UDP instead. Any suggestion about how to improve the speed because 3.5 seconds is not acceptable.
Thanks,
Simon
I created several micro services in PB Linux that all run on the same PC so no network is involved. They communicate via sending strings back and forth over TCP connections. I noticed that most of the services receive and send responses almost immediately. I did notice there were times when delays occurred. So upon further debugging I discovered that SendNetworkString is never more than 1ms but the ReceiveNetworkData function times vary quite widely from say 20 ms to 3.5 seconds for the same command. Since this is all happening in memory and the data transferred is usually less than a 2kb I wonder why the ReceiveNetworkData is so slow. I thought about changing the TCP_NODELAY or about using UDP instead. Any suggestion about how to improve the speed because 3.5 seconds is not acceptable.
Thanks,
Simon