Top Related Projects
Make JSON greppable!
GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.
Fast cross-platform HTTP benchmarking tool written in Go
HTTP load generator, ApacheBench (ab) replacement
HTTP load testing tool and library. It's over 9000!
Modern HTTP benchmarking tool
Quick Overview
Comcast is a tool designed to simulate poor network conditions for chaos and resiliency testing. It allows users to introduce packet loss, latency, bandwidth restrictions, and other network impairments to test how applications behave under suboptimal network conditions.
Pros
- Easy to use and configure
- Supports various network impairments (packet loss, latency, bandwidth limits)
- Cross-platform compatibility (Linux, macOS, Windows)
- Useful for testing application resilience and performance under poor network conditions
Cons
- Requires root/admin privileges to run
- Limited documentation and examples
- May interfere with system-wide network settings if not used carefully
- Not actively maintained (last commit was in 2019)
Code Examples
- Basic usage to add latency:
comcast --device=eth0 --latency=250
This command adds a 250ms latency to all traffic on the eth0 interface.
- Simulating packet loss:
comcast --device=eth0 --packet-loss=20%
This example introduces a 20% packet loss rate on the eth0 interface.
- Limiting bandwidth:
comcast --device=eth0 --target-bw=1000 --default-bw=1000000
This command limits the bandwidth to 1000 Kbps (1 Mbps) on the eth0 interface, with a default bandwidth of 1000000 Kbps (1 Gbps).
Getting Started
To get started with Comcast:
- Install Go (if not already installed)
- Install Comcast:
go get github.com/tylertreat/comcast
- Run Comcast with desired parameters (requires root/admin privileges):
sudo comcast --device=eth0 --latency=100 --packet-loss=5%
- To stop the network impairments:
sudo comcast --stop
Note: Always use caution when running Comcast, as it can affect your system's network performance.
Competitor Comparisons
Make JSON greppable!
Pros of gron
- Focuses on making JSON greppable, enhancing data analysis and manipulation
- Lightweight and easy to install, with no external dependencies
- Can convert JSON back to its original format, allowing for round-trip processing
Cons of gron
- Limited to JSON processing, unlike Comcast's network simulation capabilities
- Lacks advanced features for network testing and troubleshooting
- May require additional tools for complex data analysis tasks
Code Comparison
gron:
gron "https://api.github.com/repos/tomnomnom/gron" | grep "stargazers_count"
Comcast:
comcast --device=eth0 --latency=250 --target-bw=1000 --default-bw=1000000
Summary
gron is a specialized tool for JSON processing, making it easier to search and manipulate JSON data. It excels in simplicity and ease of use for JSON-related tasks. Comcast, on the other hand, is designed for network simulation and testing, offering a broader range of features for network-related operations. While gron is more focused on data manipulation, Comcast provides comprehensive network condition simulation capabilities.
GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.
Pros of GoReplay
- Focuses on HTTP traffic replay and analysis, offering more specialized features for web application testing
- Provides real-time traffic capture and replay capabilities
- Supports multiple output formats and integrations with various tools and services
Cons of GoReplay
- Limited to HTTP/HTTPS protocols, unlike Comcast's broader network simulation capabilities
- May require more setup and configuration for complex scenarios
- Less suitable for general network condition testing (e.g., latency, packet loss)
Code Comparison
GoReplay example:
gor --input-raw :8000 --output-http "http://localhost:8001"
Comcast example:
comcast --device=eth0 --latency=250 --target-bw=1000 --default-bw=1000000
Key Differences
- Purpose: GoReplay focuses on HTTP traffic replay, while Comcast simulates various network conditions
- Scope: GoReplay is specialized for web applications, Comcast is more general-purpose
- Usage: GoReplay is typically used for load testing and debugging, Comcast for network condition simulation
Use Cases
GoReplay:
- Web application load testing
- API debugging and analysis
- Traffic capture and replay for security testing
Comcast:
- Testing application behavior under poor network conditions
- Simulating network issues for troubleshooting
- Evaluating application performance across different network scenarios
Fast cross-platform HTTP benchmarking tool written in Go
Pros of Bombardier
- Written in Go, offering better performance and cross-platform compatibility
- Supports HTTP/1.1, TLS, and HTTP/2 protocols
- Provides detailed statistics and customizable output formats
Cons of Bombardier
- Focused solely on HTTP benchmarking, lacking network simulation features
- Less suitable for testing resilience against poor network conditions
- May require more setup for complex scenarios compared to Comcast
Code Comparison
Comcast (network simulation):
comcast --device=eth0 --latency=250 --target-bw=1000 --default-bw=1000000 --packet-loss=10%
Bombardier (HTTP benchmarking):
bombardier -c 100 -n 10000 http://example.com
Summary
Bombardier is a powerful HTTP benchmarking tool with support for multiple protocols and detailed statistics. It excels in performance testing but lacks network simulation capabilities. Comcast, on the other hand, focuses on simulating various network conditions, making it more suitable for testing application resilience in challenging environments. While Bombardier is ideal for load testing and benchmarking web servers, Comcast is better suited for simulating real-world network scenarios and testing application behavior under poor network conditions.
HTTP load generator, ApacheBench (ab) replacement
Pros of hey
- Designed specifically for HTTP load testing and benchmarking
- Supports multiple concurrent connections and custom headers
- Provides detailed output with various statistics and percentiles
Cons of hey
- Limited to HTTP/HTTPS protocols only
- Lacks network condition simulation features
- Less flexible for general network testing scenarios
Code comparison
hey:
h2 := "2"
if *disableKeepAlives {
h2 = "1"
}
req.Header.Set("Connection", "keep-alive")
req.Header.Set("Keep-Alive", "timeout=30")
Comcast:
func (d *Device) Enable() error {
if err := d.setupIPTables(); err != nil {
return err
}
return d.setupTrafficControl()
}
Key differences
Comcast is a tool for simulating poor network conditions, while hey is focused on HTTP load testing. Comcast offers more comprehensive network manipulation capabilities, including packet loss, latency, and bandwidth throttling. hey, on the other hand, excels at generating HTTP traffic and providing detailed performance metrics.
Comcast is more suitable for testing application behavior under various network conditions, while hey is better for assessing HTTP server performance and capacity. The choice between the two depends on the specific testing requirements and the aspects of the system being evaluated.
HTTP load testing tool and library. It's over 9000!
Pros of Vegeta
- Designed specifically for HTTP load testing and benchmarking
- Offers more detailed performance metrics and reporting
- Supports multiple output formats (JSON, CSV, Histogram)
Cons of Vegeta
- Limited to HTTP/HTTPS protocols
- Less flexible for simulating various network conditions
- Steeper learning curve for complex scenarios
Code Comparison
Vegeta (HTTP load testing):
echo "GET http://example.com" | vegeta attack -duration=5s | vegeta report
Comcast (Network condition simulation):
comcast --device=eth0 --latency=250 --target-bw=1000 --default-bw=1000000 --packet-loss=10%
Key Differences
Vegeta focuses on HTTP load testing and benchmarking, providing detailed performance metrics. It's ideal for stress-testing web applications and APIs. Comcast, on the other hand, is a network condition simulator that can emulate various network scenarios like latency, packet loss, and bandwidth limitations. It's more versatile for testing applications under different network conditions but doesn't provide specific load testing capabilities.
Vegeta is better suited for developers and QA teams looking to benchmark and optimize web services, while Comcast is more useful for simulating real-world network conditions to test application resilience and performance across various scenarios.
Modern HTTP benchmarking tool
Pros of wrk
- Designed specifically for HTTP benchmarking, offering more accurate performance measurements for web servers
- Written in C, providing better performance and lower resource usage
- Supports Lua scripting for custom request generation and response handling
Cons of wrk
- Limited to HTTP/HTTPS protocols, less versatile for general network testing
- Requires compilation, which may be less convenient for quick setup
- Less suitable for simulating real-world network conditions
Code Comparison
wrk:
static void *thread_main(void *arg) {
thread *thread = arg;
aeEventLoop *loop = thread->loop;
while (!stop) {
aeProcessEvents(loop, AE_ALL_EVENTS);
}
return NULL;
}
Comcast:
func (t *Throttler) Run() error {
for {
select {
case <-t.stop:
return nil
default:
t.processPacket()
}
}
}
Summary
wrk is a specialized HTTP benchmarking tool written in C, offering high performance and Lua scripting capabilities. Comcast, on the other hand, is a more general-purpose network simulator written in Go, focusing on simulating various network conditions. While wrk excels in HTTP performance testing, Comcast provides broader network simulation features, making each tool suitable for different use cases.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Comcast
Testing distributed systems under hard failures like network partitions and instance termination is critical, but it's also important we test them under less catastrophic conditions because this is what they most often experience. Comcast is a tool designed to simulate common network problems like latency, bandwidth restrictions, and dropped/reordered/corrupted packets.
It works by wrapping up some system tools in a portable(ish) way. On BSD-derived systems such as OSX, we use tools like ipfw
and pfctl
to inject failure. On Linux, we use iptables
and tc
. Comcast is merely a thin wrapper around these controls. Windows support may be possible with wipfw
or even the native network stack, but this has not yet been implemented in Comcast and may be at a later date.
Installation
$ go install github.com/tylertreat/comcast@latest
Usage
On Linux, Comcast supports several options: device, latency, target/default bandwidth, packet loss, protocol, and port number.
$ comcast --device=eth0 --latency=250 --target-bw=1000 --default-bw=1000000 --packet-loss=10% --target-addr=8.8.8.8,10.0.0.0/24 --target-proto=tcp,udp,icmp --target-port=80,22,1000:2000
On OSX, Comcast will check for pfctl
support (as of Yosemite), which supports the same options as above. If pfctl
is not available, it will use ipfw
instead, which supports device, latency, target bandwidth, and packet-loss options.
On BSD (with ipfw
), Comcast currently supports only: device, latency, target bandwidth, and packet loss.
$ comcast --device=eth0 --latency=250 --target-bw=1000 --packet-loss=10%
This will add 250ms of latency, limit bandwidth to 1Mbps, and drop 10% of packets to the targetted (on Linux) destination addresses using the specified protocols on the specified port numbers (slow lane). The default bandwidth specified will apply to all egress traffic (fast lane). To turn this off, run the following:
$ comcast --stop
By default, comcast will determine the system commands to execute, log them to stdout, and execute them. The --dry-run
flag will skip execution.
I don't trust you, this code sucks, I hate Go, etc.
If you don't like running code that executes shell commands for you (despite it being open source, so you can read it and change the code) or want finer-grained control, you can run them directly instead. Read the man pages on these things for more details.
Linux
On Linux, you can use iptables
to drop incoming and outgoing packets.
$ iptables -A INPUT -m statistic --mode random --probability 0.1 -j DROP
$ iptables -A OUTPUT -m statistic --mode random --probability 0.1 -j DROP
Alternatively, you can use tc
which supports some additional options.
$ tc qdisc add dev eth0 root netem delay 50ms 20ms distribution normal
$ tc qdisc change dev eth0 root netem reorder 0.02 duplicate 0.05 corrupt 0.01
To reset:
$ tc qdisc del dev eth0 root netem
BSD/OSX
To shape traffic in BSD-derived systems, create an ipfw
pipe and configure it. You can control incoming and outgoing traffic separately for any specific host or network.
$ ipfw add 1 pipe 1 ip from me to any
$ ipfw add 2 pipe 1 ip from any to me
$ ipfw pipe 1 config delay 500ms bw 1Mbit/s plr 0.1
To reset:
$ ipfw delete 1
Note: ipfw
was removed in OSX Yosemite in favor of pfctl
.
Network Condition Profiles
Here's a list of network conditions with values that you can plug into Comcast. Please add any more that you may come across.
Name | Latency | Bandwidth | Packet-loss |
---|---|---|---|
GPRS (good) | 500 | 50 | 2 |
EDGE (good) | 300 | 250 | 1.5 |
3G/HSDPA (good) | 250 | 750 | 1.5 |
DIAL-UP (good) | 185 | 40 | 2 |
DSL (poor) | 70 | 2000 | 2 |
DSL (good) | 40 | 8000 | 0.5 |
WIFI (good) | 40 | 30000 | 0.2 |
Starlink | 20 | - | 2.5 |
Top Related Projects
Make JSON greppable!
GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.
Fast cross-platform HTTP benchmarking tool written in Go
HTTP load generator, ApacheBench (ab) replacement
HTTP load testing tool and library. It's over 9000!
Modern HTTP benchmarking tool
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot