LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP VIs can really run in parallel ?

Hi all !

I'm using the STM library (over TCP) to communicate between a client and a server (which are 2 cRIOs). 2 ports are opened (55000 and 56000) because I need to send 2 kind of messages.

On the first port small messages are sent often (82 bytes every 2ms). On the other port much larger data is sent but less often (160k bytes every 50ms).

The reader is reading each port in a separate loop. The timeout of the STM read is the only thing which rules the loop timing. So each loop should run as fast as they received the data (so approximately 500Hz for the first port, 20Hz for the second).

I noticed that every 50ms, the first loop takes almost 6 to 10ms instead of the usual 2ms. So it is quite clear that the second loop as an influence on the first one...

STM VIs are all reentrant... Is it the TCP/IP library which is no reentrant or the bottleneck is much deeper (in the TCP stack ?) ?

Is there any way that I can have my two loops running independently ?

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 1 of 7
(3,911 Views)

I am fairly certain the the TCP/IP primitives are re-entrant; otherwise they would be a fairly useless language primitive. I suspect there is some other issue causing the blocking behaviour. Can you share the example that shows this?

0 Kudos
Message 2 of 7
(3,898 Views)

The TCP/IP nodes are internally fully asynchronous except a few protected resource accesses around opening and closing of refnums. But they are typically very short and should not cause any noticable delay.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 3 of 7
(3,894 Views)

The developpement is a VerisStand custom device, so it is hard to separate all things and post it here... I made some screen copies of my debug code...
Do not take care of comments written on the images, print screen have originally be made for another problem...

Can the processor work be suddenly high because of the 50ms amount of data arriving, and less priority is given to the 'fast loop' ?

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
Download All
0 Kudos
Message 4 of 7
(3,887 Views)

Here is the screenshot showing what happens.

'fast loop' is in that case reading at 100HZ (10000us), and 'slow loop' is reading at 2Hz...

You can see from the print screen that every 2Hz (500ms), my fast loop rate goes from 10000us to 15000us....

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 5 of 7
(3,847 Views)

@zyl7 wrote:

Here is the screenshot showing what happens.

'fast loop' is in that case reading at 100HZ (10000us), and 'slow loop' is reading at 2Hz...

You can see from the print screen that every 2Hz (500ms), my fast loop rate goes from 10000us to 15000us....


And then compensating right after with a loop that takes only 5000us. This looks to me more like a some contention you create yourself. Possible things could be some common subVI that you call in both loops that is not set to run reentrant, calling some other inherently non-reentrant functionality in both loops, or simply overloading your CPU in the case when it has to read those large messages and processing them in some way.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 6 of 7
(3,840 Views)

I checked reentrancy several times. I guess it is CPU, because if I reduce the amount of data to send or more often the drift is still there but less visible. The only common thing is the branch of an object...

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 7 of 7
(3,829 Views)