Brakebear
Apply network constraints (bandwidth, latency, loss) to Docker containers using Linux traffic control.
Overview
Brakebear is a network traffic control tool that applies real-world network constraints to Docker containers for testing and simulation purposes. It leverages Linux kernel networking mechanisms (HTB, IFB, Netem, and network namespaces) to enforce per-container bandwidth limiting, latency simulation, jitter injection, and packet loss emulation without stopping the containers.
The tool provides granular control over network conditions, supporting both IPv4 and IPv6 dual-stack networks with intelligent exclusion capabilities for private networks, specific CIDR ranges, DNS hostnames, TCP/UDP ports, and Docker networks.
Features
- Bandwidth Management: Set configurable upload/download rate limits (e.g., "1mbps", "500kbps")
- Network Emulation: Introduce latency, jitter, and packet loss to simulate real-world conditions
- Docker Integration: Automatic discovery and monitoring of running containers
- Dual-Stack Support: Works with both IPv4 and IPv6 networks
- Smart Filtering: Exclude traffic by:
- Private networks
- CIDR ranges
- DNS hostnames
- Specific TCP/UDP ports
- Docker networks
- Live Application: Apply constraints to active containers without requiring restarts
- Automatic Cleanup: Removes traffic control rules when containers terminate
- Technical Foundation: Uses HTB queueing, IFB interfaces, Netem for emulation, and Linux network namespaces
Use Cases
- Resilience Testing: Test application behavior under degraded network conditions
- Performance Validation: Simulate slow connections, high-latency environments, or packet loss scenarios
- Ethereum Client Testing: Validate client behavior in adverse network conditions
- Multi-Client Deployments: Test network issues in complex distributed systems
- Development & Debugging: Debug network-sensitive applications in controlled environments