[WIP] Sending A Packet To Multiple Destinations

We will discuss a simple use case that I encountered in my recent research project.

What is a low latency way to send a packet to multiple destinations?

We will compare three techniques:

  • Naive: `sendto` to each destination
  • io-uring: batch multiple `sendto`with io-uring
  • TC/eBPF: one `sendto` from userspace, capturing and replicating with eBPF
  • Overview of three techniques

    Naive Approach

    The sendto function is used in UNIX-based systems for sending messages to a specific destination. If we want to send a packet to multiple destinations, we can invoke sendto multiple times, once for each destination. This approach is not efficient for large number of destinations as each invocation of sendto leads to a syscall and a user space to kernel space context switch.

    Batching with io-uring

    Instead of invoking sendto multiple times, we can batch all the invocations using io-uring. io-uring allows us to batch multiple I/O operations and submit them to the kernel in a single syscall. This reduces the number of syscalls and context switches, improving the overall performance.

    Replicating with eBPF

    TODO