What is the one way latency?

6 posts / 0 new
Last post
Offline
Last seen: 3 days 11 min ago
Joined: 02/15/2019
Posts: 26
What is the one way latency?

Hi,

I've been doing some performance testing and just wanted some clarification on what the one way latency is.  as well as how to interpret the results that I am attaining.

I have run some 10 second latency tests and within the subscriber the last result mention that 451 packets have been sent. Is this number supposed to correspond with the amount of publisher results? There are 459 results for the publisher, so these numbers are quite close but some clarification on what these numbers would be should help greatly.

Am I right to assume that the latency is measured from the publisher to the subscriber and then back and then halved? The results mention the one way latency and this makes me assume that it is 'one way'. It would be fantastic to get some clarification and thank you for your time.

Thanks,

Blitz3r

jmorales's picture
Offline
Last seen: 22 hours 2 min ago
Joined: 08/28/2013
Posts: 36

Hello,

I believe when you say that you have been doing some performance testing you mean with the RTI Perftest application, am I right?

In that case, you are right: We measure the RTT (Round Trip Time), which corresponds to the time it takes for a sample to be sent from the publisher to the subscriber, send it back and be received in the publisher side. We assume that time is symetric (time to go equals to time to receive) and then we divide by 2, getting the Latency (One way latency).

Now, the next question is, what kind of test are you performing? Let me explain, in RTI Perftest by default you do a Throughput test, and you might be interested in doing a latencyTest:

Doing a throughput test means that it will start sending samples as fast as possible, and once every `latencyCount` samples (which for a Throughput test is 10000 samples), it will mark the sample so it is answered by the subscriber. The answer is the exact same sample, so, by getting the time when you sent it and the time when you receive it back you can get the Round-Trip Time (RTT).

The important thing here is that: Doing a Throughput test will give you the maximum throughput (mbps) at what the publisher will be able to send samples to a subscriber. The latency you will get there is there impacted by the fact that you are in a crowed network, with your queues being full. If you want to test the minimum latency you will be able to achieve, you will need to do a Latency Test instead.

In order to do a latency test, you will only need to add `-LatencyTest` to your RTI Perftest publisher command line parameters. This will change the behavior of the test. Now, instead of trying to send as fast as possible, it will do a ping pong test: Send a sample and wait until it receives it back to calculate the RTT (and therefore the Latency), then send again.

Let me know if this helps!

 

Offline
Last seen: 3 days 11 min ago
Joined: 02/15/2019
Posts: 26

Hi Javier,

Thank you very much for the very descriptive explanation. I really appreciate it.

I am doing latency tests with the following commands:

Publisher: perftest_java.bat -pub -dataLen 4096 -numSubscribers 1 -domain 1 -executionTime 10 -latencyTest

Subscriber: perftest_java.bat -sub -dataLen 4096 -domain 1

I managed to attain these results:

One-Way Latency(us): Ave(us): Std(us): Min(us): Max(us): 
407349930924076591
8242607.3332822.0174076591
18922428.52463.4894076591

I was just wondering how are the first values for the average, standard deviation, and maximum calculated? Shouldn't the numbers all be the same for the first record? So the average and maximum should be the same number?

For the throughput results here is what I got:

Packets:Packets/s:Packets/s (ave):Mbps:Mbps (ave):Lost
7539391.2790241.2790240
1224642.51.5156241.3973240
17047441.5545681.4497390
2154343.751.4109361.4400380
2634744.41.55721.463470
3124744.833331.5651.4803920
3554044.142861.3319761.459190
4074944.751.6215681.4794870
4514344.555561.4353841.4745870

This test was run for 10 seconds as seen from the executionTime parameter. However, there are only 9 rows. Do you know why this might be?

I really appreciate all the help and thank you again for your time!

Blitz3r

jmorales's picture
Offline
Last seen: 22 hours 2 min ago
Joined: 08/28/2013
Posts: 36

- With regards to your first question, you exposed something that can be improved in RTI Perftest, let me show you:

In the code, the first time we receive a sample of a given size, we don't print the latency, we just print the message you see with the datalen chage:

"********** New data length is 4096"

There in the code, internally, we do this:

// if data sized changed
        if (_lastDataLength != message.size) {
            _lastDataLength = message.size;

            if (_lastDataLength != 0 && PerfTest.printIntervals) {
                System.out.printf(
                        "\n\n********** New data length is %1$d\n",
                        _lastDataLength + PerfTest.OVERHEAD_BYTES);
            }
        } else if (PerfTest.printIntervals) {
            double latency_ave = (double)_latencySum / (double)_count;

            double latency_std = sqrt(
                (double)_latencySumSquare / (double)_count - (latency_ave * latency_ave));

            System.out.printf(
                "One-Way Latency: %1$6d us  Ave %2$6.0f us  Std %3$6.1f us  Min %4$6d us  Max %5$6d" + outputCpu + "\n",
                latency,
                latency_ave,
                latency_std,
                _latencyMin,
                _latencyMax
            );
        }
 
As you can see, the first time we enter, we hit the if and we print the message, we could make this change, and now you would see the first same as well:
 
        // if data sized changed
        if (_lastDataLength != message.size) {
            _lastDataLength = message.size;

            if (_lastDataLength != 0 && PerfTest.printIntervals) {
                System.out.printf(
                        "\n\n********** New data length is %1$d\n",
                        _lastDataLength + PerfTest.OVERHEAD_BYTES);
            }

            // Same code as in the else:
            double latency_ave = 0;
            if (_count != 0) {
                 latency_ave = (double)_latencySum / (double)_count;
            }

            double latency_std = sqrt(
                (double)_latencySumSquare / (double)_count - (latency_ave * latency_ave));

            System.out.println("1st Case ** Count is " + _count);
            System.out.printf(
                "1st Case ** One-Way Latency: %1$6d us  Ave %2$6.0f us  Std %3$6.1f us  Min %4$6d us  Max %5$6d" + outputCpu + "\n",
                latency,
                latency_ave,
                latency_std,
                _latencyMin,
                _latencyMax
            );
        } else if (PerfTest.printIntervals) {
            double latency_ave = (double)_latencySum / (double)_count;

            double latency_std = sqrt(
                (double)_latencySumSquare / (double)_count - (latency_ave * latency_ave));

            System.out.println("** Count is " + _count);
            System.out.printf(
                "One-Way Latency: %1$6d us  Ave %2$6.0f us  Std %3$6.1f us  Min %4$6d us  Max %5$6d" + outputCpu + "\n",
                latency,
                latency_ave,
                latency_std,
                _latencyMin,
                _latencyMax
            );
        }
 
The output in my case looks like this:
 
********** New data length is 4096
1st Case ** Count is 1
1st Case ** One-Way Latency:   4720 us  Ave   4720 us  Std    0.0 us  Min   4720 us  Max   4720
** Count is 2
One-Way Latency:   1116 us  Ave   2918 us  Std 1802.0 us  Min   1116 us  Max   4720
** Count is 3
One-Way Latency:    163 us  Ave   2000 us  Std 1962.5 us  Min    163 us  Max   4720
** Count is4
 
I will make sure we improve this code to either show the first sample or drop it and start counting from the second.
 
- With regards to your second question, the answer is simply that there is one timer in charge of stopping the system after 10 seconds, and we print every second (aprox), then, we usually hit the timer condition before the trigger to show the print for that second, so instead we show the summary.
 
Hope this helps. Also, as a general rule, try executing RTI Perftest in your system for 30 seconds, you will see more stable values.
Offline
Last seen: 3 days 11 min ago
Joined: 02/15/2019
Posts: 26

Hi Javier,

Thank you very very very much for the amazingly descriptive explanation again!

Coming back to my original post, here is an example of some of the tests I have run:

As seen above, the subscriber states that there are 473 cumulative packets sent. However, on the publisher side we notice that there are 518 records (excluding the first row for the headings). Why are these numbers not corresponding? Should they be corresponding? Here are other examples of longer tests where this has occured:

Above we can see that 6232 is not equal to 6210.

Here we see that 24445 is not equal to 24370.

However, there are the rare cases where the numbers do correspond. Thank you again for taking your time to answer my questions.

Blitz3r

jmorales's picture
Offline
Last seen: 22 hours 2 min ago
Joined: 08/28/2013
Posts: 36

Hi,

Let me see if I understand correctly the question: Since you are running a latency test (-latencyTest), you would expect every single sample to be answered, and therefore you would expect to see a row per sample in the publisher side, however you are seeing more than the number of samples being sent.

This is weird, because, as you well thought, I would expect every sample to be received once, and only once.

I was unable to reproduce this behavior, I've been using the following command line parameters:

Publisher

bin/release/perftest_java.sh -pub -latencyTest -numIter 1000

Subscriber

bin/release/perftest_java.sh -sub

But every single time I was getting 999 lines. I also tried by using the -executionTime, with similar results.

I instrumented the code adding these lines to the "LatencyListener.java" file, right after where we print the "One-Way Latency:"

            System.out.printf(
                "Samples received: %1$6d samples\n",
                _count
            );

But in my case, numbers match.

Could you also instrument the code as I did adding these lines and see where you receive more samples? Also, this is not probable, but could you check if in your system you have more RTI Perftest applications running.

What command lines are you using and what version of RTI Perftest?

Regards,

Javi