Skip to content

interesting max latency in 1M ping-pong  #294

Closed

Description

@Jconn

I am getting some high max latencies in the ping-pong example with large messages.

When I tried 1MB messages, the median case is only a millisecond or two. But occasionally my worst-case timing is on the order of a hundred milliseconds.

Should I try and tweak my environment or is this expected?

PingPong output below:

# payloadSize: 1000000 | numSamples: 10000 | timeOut: 0

# Waiting for startup jitter to stabilise
# Warm up complete.

# Latency measurements (in us)#
#             Latency [us]                                   Write-access time [us]       Read-access time [us]
       Seconds  Count   median   min      99%      max      Count   median      min      Count   median      min
        1        77     1139      871        0   147049         77      420      374         77       81       62
        2       141     1414      874   146430   146430        141      512      378        141       99       64
        3       336     1416     1388     1858     1872        336      510      475        336      100       95
        4       287     1418     1398     1900   141437        287      510      489        287      102       95
        5       212     2246     2220     2974     2993        212      781      732        212      155      148
        6       211     2268     2221     2990     3020        211      781      745        211      154      147
        7        73     1434      893        0   139768         73      508      323         73      115       67
        8       117     1046      890   142211   142211        117      361      324        117       77       66
        9        90     1908     1214        0   153957         90      587      401         90      119       81
       10        51     4710      893        0   129125         51     1706      325         51      345       67

Activity

  1. eboasson commented on Oct 25, 2019

    @eboasson
    Contributor

    Hi @Jconn,

    Should I try and tweak my environment or is this expected?

    I'd say it depends. I've double checked on my laptop (macOS) over loopback and I get times between (roughly) 2ms and 5ms. As the README shows, on two Ubuntu boxes over GbE it varies between 9ms and 10ms (from the raw data referenced by the README).

    If you are on Linux and using loopback, I would guess the latency spikes are related to packet loss and retransmits. One way that can happen is if the 1MB samples occasionally overflow the UDP socket receive buffer. The default configuration of Cyclone (this) requests a 1MB buffer for these, but the default kernel limits are lower and so in a default-default configuration on Ubuntu 18.04 you'll end up with 425984 bytes. A bit of a delay in scheduling the thread reading from the socket can then easily cause an overflow.

    To see what you buffer size you actually have, try this: CYCLONEDDS_URI='<Tracing><Verbosity>config</><OutputFile>stdout' bin/ddsperf pong, for me it says failed to increase socket receive buffer size to 1048576 bytes, continuing with 425984 bytes. You can raise the kernel limit pretty easily.

    Certainly if Linux is running in a VM, those numbers you get are perfectly in line with what I get running that same test on Ubuntu inside a VM on macOS with the default configuration of everything.

    Note that this is really very system dependent: macOS will happily give it the 1MB it asks for, and I think Windows does, too. And it turns out the machines I used for the GbE test have larger UDP buffers configured ... guess I need to update the system configuration details for the benchmark data in the README ...

    And as a side note: do consider using ddsperf instead of the roundtrip and throughput examples. The output is a bit messier, but it includes a lot more information 🙂.

  2. Jconn commented on Oct 25, 2019

    @Jconn
    Author

    @eboasson great answer, thank you.

    I also got the message failed to increase socket receive buffer size to 1048576 bytes, continuing with 425984 bytes in my log. I followed that link, raised my max buffer size, and now my max latencies aren't crazy outliers anymore.

    I ran this on two computers with ubuntu 18.04 running loopback, no VMs, both needed their buffer size expanded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions