Skip to content

derp: DERP Return Path Optimization (DRPO) #150

Closed

Description

@bradfitz

Currently DERP does asymmetric routing. If A and B have different home nodes (say, SF and NY), then A sends to B via NY and B sends to A via SF.

But there's an optimization we could do:

One of the packets has to arrive first. When A (connected to its home node SF), gets a packet from B via DERP SF, it can add a "DERP routing table entry" for that public key to go via that specific DERP TCP connection, keeping that routing entry alive until either: a) the TCP connection dies (for whatever reason), or b) the server sends a "previous sender disconnected" frame.

So then the server would just need to keep track of all the public keys that have sent a node a message, and upon a TCP connection, the DERP SF server can tell A that B is disconnected, and A can remove its routing table entry.

So now, when A wants to send a reply packet (or any packet) to B, it first looks to see if it has an explicit DERP route for B, otherwise it falls back to using B's DERP home node. That also means less latency on the first reply, since it doesn't need to do the TCP+TLS+DERP round trips to set up the connection. And it minimizes overall connections & memory use.

Again, this is just an optimization (that should trigger a lot; we could add varz) and the fallback behavior would be the same as today.

/cc @crawshaw @danderson

Activity

  1. added
    connectivity
    on Mar 6, 2020
  2. changed the title [-]derp: possible protocol change to reduce visiting DERP conns[/-] [+]derp: DERP Return Path Optimization (DRPO)[/+] on Mar 22, 2020
  3. added 6 commits that reference this issue on Mar 22, 2020
    c349869
    39d3f43
    508b096
    4c926ea
    5ad8e56
    1ab5b31
  4. apenwarr commented on Apr 21, 2020

    @apenwarr
    Member

    Note that this might not be optimal at all: in general (and to way overgeneralize, sigh), packets leaving a cloud provider we get charged for, while packets entering a cloud provider we don't. If someone wants to run their own DERP server inside their own network, we'd like to use that whenever possible for incoming packets - it (in theory) won't cost anything to retransmit them to machines on the same LAN. Whereas a DERP relay hosted elsewhere, even colocated with the transmitter, might pay extra fees.

  5. 13 remaining items

  6. DentonGentry commented on Mar 11, 2022

    @DentonGentry
    Contributor

    Fixed in 1.22.0 by #3730

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

Metadata

Metadata

Assignees

Labels

L2 FewP1 NuisanceT3 Performance/Debuggingconnectivityoptimization

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions