Skip to content

Latency is not working properly #1488

@marten-seemann

Description

@marten-seemann

I'm setting up a test plan where I measure the time it takes for one libp2p host to connect to another host.

The latency of the link is set via:

initCtx.NetClient.MustConfigureNetwork(ctx, &network.Config{
		Network:        "default",
		Enable:         true,
		Default:        network.LinkShape{Latency: latency},
		CallbackState:  sync.State("network-configured"),
		CallbackTarget: runenv.TestInstanceCount,
	})

In my case, latency = 25 * time.Millisecond, thus the RTT should be 50 ms.

By recording a qlog I can see when exactly a packet was sent. Interestingly, the first flight takes 100ms, not 50ms:

image

What you can see is that the client sends the first packet (initial: 0) to the server, and the server responds with a packet (initial: 0, acknowledging the client's first packet).

Interestingly, things change for the second flight:

Screenshot 2022-10-08 at 12-38-42 qvis tools and visualizations for QUIC and HTTP_3

The client sends a whole bunch of packets, which are received by the server and responded to. The response to these packets arrives at t = 157 ms, so after just 54 ms.

It looks like the RTT for the first flight is twice the RTT for the second flight. I'm also not sure if the link simulated here is actually symmetric: The packet from the client is received after 77ms, suggesting that the it took the clients first flight 3*latency to reach the server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Blocked

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions