How to Install and Use oha in Linux for Real-Time HTTP Load Testing and Benchmarking

Evaluating web server throughput and testing application capacity under heavy concurrent traffic typically relies on command-line utilities such as ab (ApacheBench) or wrk. While effective, traditional benchmarkers output static summary tables only after tests complete, providing zero visibility into real-time latency spikes, HTTP response code distributions, or socket errors while the load test is running. oha is a modern, terminal-native HTTP load generation and benchmarking tool written in Rust that renders dynamic real-time progress visualisations directly inside your Linux shell.

Featuring support for HTTP/2, custom SSL/TLS certificates, real-time latency histogram charts, percentile breakdowns, and structured JSON output, oha turns API stress-testing into an intuitive, responsive process.

Installing oha on Linux

oha provides pre-compiled standalone binaries, package manager options, and Cargo builds across Linux distributions.

Method 1: Direct Binary Download (Recommended)

# Download latest release matching x86_64 architecture
curl -s https://api.github.com/repos/hatoo/oha/releases/latest \
  | grep "browser_download_url.*oha-linux-amd64" \
  | cut -d : -f 2,3 \
  | tr -d \" \
  | wget -qi -

# Make executable and move into PATH
chmod +x oha-linux-amd64
sudo mv oha-linux-amd64 /usr/local/bin/oha

Method 2: Using Cargo (Rust)

If you maintain a local Rust environment:

cargo install oha

Method 3: Arch Linux (Pacman)

sudo pacman -S oha

Confirm that the binary is reachable by checking the version:

oha --version

Running a Basic HTTP Benchmark

To execute a quick load test against a web endpoint, supply the target URL:

oha https://api.example.com/health

By default, oha dispatches 200 total requests across 50 concurrent worker connections. During execution, the terminal canvas transforms into an active dashboard displaying:

  • Requests Per Second (RPS): Real-time throughput gauge updated continuously.
  • Latency Histogram: Visual ASCII bar chart illustrating response latency distribution across time intervals.
  • Percentile Analysis: Accurate breakdown of 10th, 25th, 50th (median), 75th, 90th, 95th, and 99th percentile response latencies.
  • HTTP Status Breakdown: Summary counter tallying 200 OK, 4xx Client Error, and 5xx Server Error responses.

Configuring Load Volume and Concurrency

For realistic capacity planning, fine-tune the request volume and concurrent client connections:

Setting Total Requests and Concurrency

oha -n 10000 -c 100 https://api.example.com/products
  • -n 10000: Issues exactly 10,000 total requests before stopping.
  • -c 100: Maintains 100 concurrent worker connections in parallel.

Running Time-Based Stress Tests

To run a continuous soak test for a fixed duration rather than a set request count:

oha -z 30s -c 50 https://api.example.com/checkout

The -z 30s flag runs the benchmark for exactly 30 seconds, continuously measuring server resilience under sustained pressure.

Rate Limiting Output (Queries Per Second)

To prevent overwhelming internal microservices or triggering upstream Cloudflare rate-limiting:

oha -q 250 -c 50 https://api.example.com/search

The -q 250 flag caps request generation to 250 queries per second (QPS).

Benchmarking POST Requests with JSON Payloads

Testing API endpoints that require authentication headers and request bodies is straightforward:

oha -m POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer test_token_xyz" \
  -d '{"itemId": 42, "quantity": 1}' \
  https://api.example.com/v1/cart
  • -m POST: Specifies the HTTP request method.
  • -H: Appends custom HTTP request headers (can be specified multiple times).
  • -d: Injects the raw string request body.
  • Alternatively, pass -D /path/to/payload.json to stream request data directly from a local file.

Enabling HTTP/2 and Protocol Customisations

By default, oha negotiates HTTP versions via ALPN, but you can force modern protocols:

# Force HTTP/2 over TLS
oha --http2 https://api.example.com

# Disable TLS certificate verification (useful for internal staging environments)
oha --insecure https://staging.internal.net

Exporting Benchmark Results to JSON for CI/CD

When running load tests in automated deployment scripts or GitHub Actions pipelines where terminal UIs cannot render:

oha --no-tui --json https://api.example.com/status > results.json

The --no-tui flag suppresses interactive terminal drawing, and --json prints a machine-readable JSON object containing latency metrics, error counts, and timestamp percentiles suitable for automated regression analysis.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.