TCP echo over loopback
tcp_echo · compared across machine types · 8 Series on 8 machine types · AWS us-east-2
CPU
| Compare | Machine | Variant | P50 | P99 | Rate | Runs |
|---|---|---|---|---|---|---|
| c8a.2xlarge | 6.871 µs | — | 4.769 GB/s | 89 | ||
| c8g.2xlarge | 15.35 µs | — | 2.134 GB/s | 4 | ||
| c6i.8xlarge | 24.56 µs | — | 1.334 GB/s | 89 | ||
| i4i.2xlarge | 24.84 µs | — | 1.319 GB/s | 89 | ||
| m6id.2xlarge | 25.17 µs | — | 1.302 GB/s | 1 | ||
| m5.large | 26.47 µs | — | 1.238 GB/s | 91 | ||
| i4g.2xlarge | 29.17 µs | — | 1.123 GB/s | 4 | ||
| c8i.2xlarge | 46.34 µs | — | 707.1 MB/s | 89 |
Compared:m5.largec8g.2xlargec8i.2xlarge
Run-to-run spread
time per round trip across counted RunsOver time
newest counted Runs, time per round trip(one request each to the data API)
What this measures
The round trip of a buffer over loopback TCP inside one process, between its main thread and a server thread that echoes it back: the kernel's TCP stack and system calls, with no network card and no network.
What it does not measure
- Loopback involves no network card and no other machine. It is not a figure for traffic between two machines.
- One connection, opened before measuring, carries every repetition, so opening a connection is not in the figure.
- A repetition also hashes every 997th byte it read back, and the last, so the figure is not the kernel's work alone.
Code & config
Benchmark docsSeries JSONc8i.2xlarge
66static void send_all(int fd, const uint8_t *buf, size_t len) {67 size_t off = 0;68 while (off < len) {69 ssize_t n = send(fd, buf + off, len - off, MSG_NOSIGNAL);// …79static void recv_exact(int fd, uint8_t *buf, size_t len) {80 size_t off = 0;81 while (off < len) {82 ssize_t n = recv(fd, buf + off, len - off, 0);// …103/* One repetition: one round trip of the whole buffer. */104static uint64_t tcp_echo_run(void *arg) {105 tcp_echo_ctx_t *ctx = (tcp_echo_ctx_t *)arg;106 send_all(ctx->client_fd, ctx->send_buf, ctx->bytes);107 recv_exact(ctx->client_fd, ctx->recv_buf, ctx->bytes);108 return checksum_echo(ctx->recv_buf, ctx->bytes);109}// …233 lm_measure(tcp_echo_run, &tcp);
Configuration
- benchmarktcp_echo
- buildstatic
- instancec8i.2xlarge
- regionus-east-2
- azuse2-az3
- params.size_bytes32768