GitHub

GitHub Actions Crates.io Arch Linux Homebrew

ko-fi

oha is a tiny program that sends some load to a web application and show realtime tui inspired by rakyll/hey.

This program is written in Rust and powered by tokio and beautiful tui by ratatui.

demo

Installation

This program is built on stable Rust, with both make and cmake prerequisites to install via cargo.

cargo install oha

You can optionally build oha against native-tls instead of rustls.

cargo install --no-default-features --features native-tls oha

You can enable VSOCK support by enabling vsock feature.

cargo install --features vsock oha

You can enable experimental HTTP3 support by enabling the http3 feature. This uses the H3 library by the developers of Hyper. It will remain experimental as long as H3 is experimental. It currently depends on using rustls for TLS.

Download pre-built binary

You can download pre-built binary from Release page for each version and from Publish workflow and Publish PGO workflow for each commit.

On Arch Linux

pacman -S oha

On macOS (Homebrew)

brew install oha

On Windows (winget)

winget install hatoo.oha

On Debian (Azlux's repository)

echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ stable main" | sudo tee /etc/apt/sources.list.d/azlux.list
sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg
apt update
apt install oha

X-CMD (Linux, macOS, Windows WSL/GitBash)

You can install with x-cmd.

x env use oha

Containerized

Official Docker image

ghcr.io/hatoo/oha

Build image locally

You can also build and create a container image including oha

docker build -t hatoo/oha:latest .

Then you can use oha directly through the container

docker run --rm -it --network=host hatoo/oha:latest https://example.com:3000

Profile-Guided Optimization (PGO)

You can build oha with PGO by using the following commands:

bun run pgo.js

And the binary will be available at target/[target-triple]/pgo/oha.

Note: Please keep in mind that in order to run the aforementioned command, you need to have installed cargo-pgo cargo package.

You can install it via cargo install cargo-pgo.

Platform

  • Linux - Tested on Ubuntu 18.04 gnome-terminal
  • Windows 10 - Tested on Windows Powershell
  • MacOS - Tested on iTerm2

Usage

-q option works different from rakyll/hey. It's set overall query per second instead of for each workers.

"Ohayou(おはよう), HTTP load generator, inspired by rakyll/hey with tui animation. Usage: oha [OPTIONS] Arguments: Target URL or file with multiple URLs. Options: -n Number of requests to run. Accepts plain numbers or suffixes: k = 1,000, m = 1,000,000 (e.g. 10k, 1m). [default: 200] -c Number of connections to run concurrently. You may should increase limit to number of open files for larger `-c`. [default: 50] -p Number of parallel requests to send on HTTP/2. `oha` will run c * p concurrent workers in total. [default: 1] -z Duration of application to send requests. On HTTP/1, When the duration is reached, ongoing requests are aborted and counted as "aborted due to deadline" You can change this behavior with `-w` option. Currently, on HTTP/2, When the duration is reached, ongoing requests are waited. `-w` option is ignored. Examples: -z 10s -z 3m. -w, --wait-ongoing-requests-after-deadline When the duration is reached, ongoing requests are waited -q Rate limit for all, in queries per second (QPS) --burst-delay Introduce delay between a predefined number of requests. Note: If qps is specified, burst will be ignored --burst-rate Rates of requests for burst. Default is 1 Note: If qps is specified, burst will be ignored --rand-regex-url Generate URL by rand_regex crate but dot is disabled for each query e.g. http://127.0.0.1/[a-z][a-z][0-9]. Currently dynamic scheme, host and port with keep-alive do not work well. See https://docs.rs/rand_regex/latest/rand_regex/struct.Regex.html for details of syntax. --urls-from-file Read the URLs to query from a file --max-repeat A parameter for the '--rand-regex-url'. The max_repeat parameter gives the maximum extra repeat counts the x*, x+ and x{n,} operators will become. [default: 4] --dump-urls Dump target Urls times to debug --rand-regex-url --latency-correction Correct latency to avoid coordinated omission problem. It's ignored if -q is not set. --no-tui No realtime tui --fps Frame per second for tui. [default: 16] -m, --method HTTP method [default: GET] -H Custom HTTP header. Examples: -H "foo: bar" --proxy-header Custom Proxy HTTP header. Examples: --proxy-header "foo: bar" -t Timeout for each request. Default to infinite. --connect-timeout Timeout for establishing a new connection. Default to 5s. [default: 5s] -A HTTP Accept Header. -d HTTP request body. -D HTTP request body from file. -Z HTTP request body from file line by line. -F, --form

Read the original on github.com ↗