A high-performance command-line tool for testing REST API endpoints with latency analysis, uptime monitoring, and rate limit detection.
- Latency Test: Measures average, median, and 90th percentile response times
- Uptime Test: Tracks success rates and error breakdowns
- Rate Limit Detection: Uses binary search to find maximum sustainable RPS
- Configurable Parameters: Adjust request counts, timeouts, and rate limits
- Structured Logging: Built with zerolog for professional log management
- Query Parameter Support: Test endpoints with complex query strings
- Content Agnostic: Works with any HTTP endpoint (JSON, XML, HTML, etc.)
- Extensible Architecture: Modular design for easy addition of new tests
git clone https://github.com/bryanlabs/rest-performance-analyzer
cd rest-performance-analyzer
go build -o rest-performance-analyzer .# Test Coinbase API with default settings (100 requests)
./rest-performance-analyzer "https://api.coinbase.com/v2/prices/BTC-USD/spot"
# Test with query parameters
./rest-performance-analyzer "https://api.kraken.com/0/public/Ticker" --pair=XXBTZUSD# Run only latency test
./rest-performance-analyzer --test=latency --requests=5 "https://httpbin.org/delay/1"
# Run only uptime test
./rest-performance-analyzer --test=uptime --requests=5 "https://jsonplaceholder.typicode.com/posts/1"
# Run only rate limit detection
./rest-performance-analyzer --test=ratelimit --rate-low=1 --rate-high=3 --rate-duration=2 "https://api.coinbase.com/v2/prices/BTC-USD/spot"
# Run all tests
./rest-performance-analyzer --test=all --requests=5 --rate-low=1 --rate-high=2 --rate-duration=2 "https://httpbin.org/json"# Custom request count and timeout
./rest-performance-analyzer --requests=10 --timeout=30 "https://api.github.com/zen"
# Rate limit testing with custom range
./rest-performance-analyzer --test=ratelimit --rate-low=5 --rate-high=10 --rate-duration=2 "https://api.coinbase.com/v2/prices/ETH-USD/spot"
# Debug logging to see HTTP responses
./rest-performance-analyzer --log-level=debug --requests=3 "https://httpbin.org/json"# Use configuration file for complex setups
./rest-performance-analyzer --config config.yaml
# Override config file settings with CLI flags
./rest-performance-analyzer --config config.yaml --test=uptime --requests=5 --log-level=debug
# Rate limit testing with custom parameters
./rest-performance-analyzer --config config.yaml --test=ratelimit --rate-high=3 --rate-duration=2 --log-level=debug
# Fast CI testing with config file and CLI overrides
./rest-performance-analyzer --config config.yaml --requests=10 --timeout=5 --log-level=warn| Flag | Default | Description |
|---|---|---|
--config |
Path to YAML configuration file | |
--requests |
100 | Number of requests for latency/uptime tests |
--timeout |
10 | Request timeout in seconds |
--test |
basic | Test type: basic, all, latency, uptime, ratelimit |
--log-level |
info | Log level: debug, info, warn, error |
| Flag | Default | Description |
|---|---|---|
--rate-low |
1 | Minimum RPS for binary search |
--rate-high |
10 | Maximum RPS for binary search |
--rate-duration |
3 | Duration for each RPS test (seconds) |
--rate-sleep |
1 | Sleep between rate limit tests (seconds) |
✅ Latency Test:
Average Latency: 34.41ms
Median Latency: 31.47ms
90th Percentile: 38.93ms
Success Rate: 100.0%
✅ Rate Limit Detection Test:
Maximum sustainable RPS: 938 (tested range: 5-1000, 3s per test)
When using --log-level=debug, you'll see detailed HTTP request/response information including:
- Request URLs with query parameters
- Response status codes and content
- Request durations
- Error details for failed requests
# Coinbase BTC price
./rest-performance-analyzer "https://api.coinbase.com/v2/prices/BTC-USD/spot"
# Kraken ticker data
./rest-performance-analyzer "https://api.kraken.com/0/public/Ticker" --pair=XXBTZUSD
# CoinGecko API
./rest-performance-analyzer "https://api.coingecko.com/api/v3/simple/price" --ids=bitcoin --vs_currencies=usd# JSONPlaceholder (fake REST API for testing)
./rest-performance-analyzer "https://jsonplaceholder.typicode.com/posts/1"
# HTTPBin (HTTP testing service)
./rest-performance-analyzer "https://httpbin.org/json"
./rest-performance-analyzer "https://httpbin.org/delay/2"
# ReqRes API (testing REST services)
./rest-performance-analyzer "https://reqres.in/api/users/2"# Conservative rate limit test - safe for demos
./rest-performance-analyzer --test=ratelimit --rate-low=1 --rate-high=3 --rate-duration=2 "https://api.coinbase.com/v2/prices/BTC-USD/spot"
# Test a more forgiving endpoint
./rest-performance-analyzer --test=ratelimit --rate-low=5 --rate-high=10 --rate-duration=2 "https://httpbin.org/json"# Quick health check
./rest-performance-analyzer --requests=10 --timeout=5 "https://api.github.com/zen"
# Comprehensive API testing
./rest-performance-analyzer --test=all --requests=10 --rate-low=1 --rate-high=3 --rate-duration=2 "https://jsonplaceholder.typicode.com/posts/1"
# Monitor endpoint performance
./rest-performance-analyzer --requests=20 --log-level=warn "https://httpbin.org/delay/1"The tool supports YAML configuration files for complex testing scenarios:
num_requests: 100
timeout: "10s"
log_level: "info"
test_type: "basic"
rate_limit:
sleep: "1s"
low_rps: 1
high_rps: 10
test_duration: "3s"
endpoints:
- name: "Coinbase BTC Price"
url: "https://api.coinbase.com/v2/prices/BTC-USD/spot"
params: {}
- name: "Kraken Ticker"
url: "https://api.kraken.com/0/public/Ticker"
params:
pair: "XXBTZUSD"The configuration file provides sensible defaults, but you can override any setting with CLI flags:
CI/CD Usage:
./rest-performance-analyzer --config config.yaml --requests=10 --timeout=5 --log-level=warnRate Limit Testing:
./rest-performance-analyzer --config config.yaml --test=ratelimit --rate-high=3 --rate-duration=2 --log-level=debugDevelopment Testing:
./rest-performance-analyzer --config config.yaml --test=all --requests=10 --rate-low=1 --rate-high=3 --rate-duration=2- CLI flags override everything
- Config file settings are used if no CLI override
- Built-in defaults are used as fallback
The tool follows a modular architecture:
main.go: CLI interface and configurationclient/: HTTP client with timing and loggingtester/: Modular test framework with individual test implementationslatency.go: Latency measurement and statisticsuptime.go: Success rate and error trackingratelimit.go: Binary search rate limit detection
go build -o rest-performance-analyzer .go test ./...- Implement the
Testerinterface in a new file - Add the tester to
NewRunner()intester/tester.go - Add CLI support in
main.go
- Rate Limit Testing: Use conservative ranges to avoid getting banned from APIs
- Demo Settings: Default rate limits (1-10 RPS) are safe for demonstrations
- Production APIs: Always check API documentation for rate limits before testing
- Error Logging: Use debug mode to investigate issues without overwhelming logs
Try these commands to see the tool in action:
# Build the tool
go build -o rest-performance-analyzer .
# Quick test with a reliable endpoint
./rest-performance-analyzer --requests=10 "https://httpbin.org/json"
# Use the configuration file
./rest-performance-analyzer --config config.yaml
# See detailed HTTP information
./rest-performance-analyzer --requests=5 --log-level=debug "https://api.github.com/zen"
# Test rate limiting (very conservative)
./rest-performance-analyzer --test=ratelimit --rate-low=1 --rate-high=3 --rate-duration=2 "https://api.coinbase.com/v2/prices/BTC-USD/spot"Licensed under the Apache License, Version 2.0. See LICENSE for details.