|
3 | 3 | [](https://github.com/yuuki/tcpulse/actions/workflows/test.yml) |
4 | 4 | [](https://deepwiki.com/yuuki/tcpulse) |
5 | 5 |
|
6 | | -tcpulse is a high-performance TCP/UDP connection load generator and performance measurement tool written in Go. |
| 6 | +tcpulse is a concurrent TCP/UDP load generator written in Go that provides fine-grained, flow-level control over connection establishment and data transfer. |
| 7 | + |
| 8 | +## Table of Contents |
| 9 | + |
| 10 | +- [What is tcpulse?](#what-is-tcpulse) |
| 11 | +- [Why use tcpulse?](#why-use-tcpulse) |
| 12 | +- [How it works](#how-it-works) |
| 13 | + - [Persistent Connections](#persistent-connections) |
| 14 | + - [Ephemeral Connections](#ephemeral-connections) |
| 15 | + - [Key Features](#key-features) |
| 16 | +- [Installation](#installation) |
| 17 | + - [Pre-built Binaries](#pre-built-binaries) |
| 18 | + - [Build from Source](#build-from-source) |
| 19 | + - [Verify Installation](#verify-installation) |
| 20 | +- [Usage](#usage) |
| 21 | +- [Examples](#examples) |
| 22 | + - [Commands](#commands) |
| 23 | + - [Reports](#reports) |
| 24 | +- [Use Cases](#use-cases) |
| 25 | + - [eBPF Kernel Tracer Overhead Measurement](#ebpf-kernel-tracer-overhead-measurement) |
| 26 | + - [L4 Load Balancer Distribution Verification](#l4-load-balancer-distribution-verification) |
| 27 | + - [Firewall/Conntrack Table Exhaustion Testing](#firewallconntrack-table-exhaustion-testing) |
| 28 | + - [UDP Packet Rate Tolerance (Real-time Delivery Simulation)](#udp-packet-rate-tolerance-real-time-delivery-simulation) |
| 29 | + - [Thread Pinning/IRQ Affinity Tuning Effect Measurement](#thread-pinningirq-affinity-tuning-effect-measurement) |
| 30 | + - [Multi-target Infrastructure Validation](#multi-target-infrastructure-validation) |
| 31 | + - [Usage Guidelines](#usage-guidelines) |
| 32 | +- [Comparison with Other Tools](#comparison-with-other-tools) |
| 33 | + - [Bandwidth Measurement Tools](#bandwidth-measurement-tools) |
| 34 | + - [tcpulse's Unique Positioning](#tcpulses-unique-positioning) |
| 35 | + - [tcpulse's Limitations](#tcpulses-limitations) |
| 36 | +- [License](#license) |
7 | 37 |
|
8 | 38 | ## What is tcpulse? |
9 | 39 |
|
10 | | -tcpulse is a specialized tool designed to measure and analyze the performance characteristics of network connections. It operates in two primary modes: |
| 40 | +tcpulse is a specialized tool designed to generate load on network connections and analyze the performance characteristics of network traffic. It operates in two primary modes: |
11 | 41 |
|
12 | 42 | - **Server mode (`-s/--server`)**: Acts as an echo server that accepts TCP/UDP connections and echoes back received data |
13 | 43 | - **Client mode (`-c/--client`)**: Generates configurable load against target servers and measures connection performance metrics |
@@ -202,6 +232,108 @@ The JSON Lines format includes the following fields: |
202 | 232 | - `rate_per_sec`: Average request rate per second |
203 | 233 | - `timestamp`: ISO 8601 timestamp when the measurement was completed |
204 | 234 |
|
| 235 | +## Use Cases |
| 236 | + |
| 237 | +tcpulse is particularly well-suited for performance validation of network devices and middlewares that relay end-to-end communications. Below are typical experimental scenarios that can be completed with tcpulse alone, which would be difficult to reproduce with iperf/netperf. |
| 238 | + |
| 239 | +### eBPF Kernel Tracer Overhead Measurement |
| 240 | + |
| 241 | +Quantify additional latency in the kernel TCP stack when numerous kprobe/tracepoints are active. Use persistent mode to maintain 10k connections and continuously echo for 1 minute, observing how many microseconds the `p99_latency` increases when eBPF is enabled vs disabled. |
| 242 | + |
| 243 | +```bash |
| 244 | +tcpulse -c --flavor persistent --connections 10000 --duration 60s 10.0.0.2:9100 |
| 245 | +``` |
| 246 | + |
| 247 | +### L4 Load Balancer Distribution Verification |
| 248 | + |
| 249 | +Verify that an L4 LB can evenly distribute connections across N backends. Generate 10k CPS (connections per second) using ephemeral mode against the L4 LB's VIP (Virtual IP) address, while collecting connection counts on the backend side to calculate standard deviation. |
| 250 | + |
| 251 | +```bash |
| 252 | +tcpulse -c --flavor ephemeral --rate 10000 --duration 30s 10.0.0.2:9100 |
| 253 | +``` |
| 254 | + |
| 255 | +### Firewall/Conntrack Table Exhaustion Testing |
| 256 | + |
| 257 | +Investigate the "new connections per second capacity" of stateful FW/NAT and behavior when tables are exhausted. Place tcpulse client behind NAT, execute ephemeral mode at 40k CPS for 2 minutes, while simultaneously collecting NAT router memory usage and packet loss statistics. |
| 258 | + |
| 259 | +```bash |
| 260 | +tcpulse -c --flavor ephemeral --rate 40000 --duration 120s 192.0.2.10:9100 |
| 261 | +``` |
| 262 | + |
| 263 | +### UDP Packet Rate Tolerance (Real-time Delivery Simulation) |
| 264 | + |
| 265 | +Verify that QoS policing and NIC interrupt tuning don't break under VoIP/Gaming-style traffic. Execute UDP at 25k * 2 pps for 10 minutes with 64-byte payload fixed to observe jitter. |
| 266 | + |
| 267 | +```bash |
| 268 | +tcpulse -c --proto udp --rate 25000 --duration 10m --message-bytes 64 198.51.100.5:9100 |
| 269 | +``` |
| 270 | + |
| 271 | +### Thread Pinning/IRQ Affinity Tuning Effect Measurement |
| 272 | + |
| 273 | +Measure how throughput and latency change when NIC interrupts are pinned to specific CPU cores. Use persistent 5k connections, measuring continuously for 5 minutes before and after affinity changes. |
| 274 | + |
| 275 | +```bash |
| 276 | +tcpulse -c --flavor persistent --connections 5000 --duration 300s 10.1.1.50:9100 |
| 277 | +``` |
| 278 | + |
| 279 | +### Multi-target Infrastructure Validation |
| 280 | + |
| 281 | +Test multiple endpoints simultaneously to validate distributed system performance under realistic load patterns: |
| 282 | + |
| 283 | +```bash |
| 284 | +# Test multiple services with different load patterns |
| 285 | +tcpulse -c --flavor ephemeral --rate 5000 --duration 60s \ |
| 286 | + service1.example.com:9100 \ |
| 287 | + service2.example.com:9200 \ |
| 288 | + service3.example.com:9300 |
| 289 | +``` |
| 290 | + |
| 291 | +### Usage Guidelines |
| 292 | + |
| 293 | +| Requirement | tcpulse | iperf3 / netperf | |
| 294 | +|---|---|---| |
| 295 | +| **Fixed CPS/pps Control** | ✅ | △ (coarse with `-b` only) | |
| 296 | +| **Maintain 10k+ Concurrent Flows** | ✅ (`persistent`) | △ (`-P` limit ~128) | |
| 297 | +| **Multi-target Support** | ✅ (`--addrs-file`) | ❌ | |
| 298 | +| **Automatic Percentile Statistics (p95/p99)** | ✅ | △ (netperf: mean/max only) | |
| 299 | +| **Integrated Control & Measurement** | ✅ | ✅/○ | |
| 300 | + |
| 301 | +## Comparison with Other Tools |
| 302 | + |
| 303 | +Network performance testing and load generation tools serve different purposes. Here's how tcpulse compares to popular alternatives: |
| 304 | + |
| 305 | +### Bandwidth Measurement Tools |
| 306 | + |
| 307 | +**[iperf3](https://iperf.fr/)** is one of the most widely used network performance measurement tools. It supports both TCP and UDP protocols and provides JSON output and multi-stream capabilities. Its primary purpose is **measuring maximum network bandwidth** - answering "What's the maximum Mbps this network can achieve?" While UDP mode allows coarse message rate control via the `-b` option, and multi-target testing can be achieved through external script parallelization, the tool is fundamentally designed for 1-to-1 communication. |
| 308 | + |
| 309 | +**[netperf](https://github.com/HewlettPackard/netperf)** is a comprehensive network performance benchmark tool that targets both bulk data transfer and request/response performance. It offers various test types including TCP_STREAM, UDP_STREAM, TCP_RR, and UDP_RR with extensive parameter tuning capabilities. The `*_RR` tests provide microsecond-level latency statistics (min/mean/p90/p99, etc.) as standard output, emphasizing not just throughput but also latency measurement. It excels in network equipment performance evaluation and comparing different network configurations. |
| 310 | + |
| 311 | +**[nuttcp](https://nuttcp.net/)** specializes in high-speed UDP testing with features like burst mode and CPU core selection, making it suitable for performance measurement of networks exceeding 10Gbps. |
| 312 | + |
| 313 | +### tcpulse's Unique Positioning |
| 314 | + |
| 315 | +**tcpulse** is designed to answer "How does the network or application behave under specified load conditions?" Specifically: |
| 316 | + |
| 317 | +**Load Pattern Control**: Ephemeral mode precisely controls new connection generation rates, while persistent mode controls concurrent connection counts. This enables analysis like "CPU usage changes when applying 1000 connections/second load for 30 minutes." While iperf3's UDP mode allows coarse control via bitrate specification, precise connection generation rate control for TCP or long-term precise load maintenance is challenging with existing tools. |
| 318 | + |
| 319 | +**Experiment Reproducibility**: Running with the same parameters reproduces identical load patterns, making it effective for comparative experiments under different conditions and problem reproduction. |
| 320 | + |
| 321 | +**Distributed System Support**: Provides multi-server simultaneous load generation capability within a single tool. Existing tools often require external script-based parallel execution. |
| 322 | + |
| 323 | +These characteristics make tcpulse particularly suitable for **operational validation under realistic load conditions** rather than exploring system performance limits. |
| 324 | + |
| 325 | +### tcpulse's Limitations |
| 326 | + |
| 327 | +However, tcpulse has certain limitations: |
| 328 | + |
| 329 | +**Not Suitable for Maximum Throughput Measurement**: For pure bandwidth measurement like "What's the maximum Gbps this network can achieve?", iperf3 is more appropriate. tcpulse focuses on load control and isn't optimized for maximum performance exploration. |
| 330 | + |
| 331 | +**Overkill for Health Monitoring**: For simply checking if a server is alive or measuring basic latency, ping or curl is sufficient. tcpulse's multi-functionality can be overly complex for simple tests. |
| 332 | + |
| 333 | +**No High-Layer Protocol Support**: Doesn't directly support L7 protocols like HTTP, HTTP/2, or QUIC. Verifying protocol-specific performance characteristics requires dedicated tools or libraries (e.g. [wrk](https://github.com/wg/wrk), [vegeta](https://github.com/tsenart/vegeta), [hey](https://github.com/rakyll/hey), etc.). |
| 334 | + |
| 335 | +**Limited Network Diagnostic Features**: Detailed packet content analysis or network path problem identification requires separate packet capture tools like [Wireshark](https://www.wireshark.org/) or [tcpdump](https://www.tcpdump.org/). |
| 336 | + |
205 | 337 | ## License |
206 | 338 |
|
207 | 339 | This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details. |
0 commit comments