#cli #load-testing #performance #http

app oha

Ohayou(おはよう), HTTP load generator, inspired by rakyll/hey with tui animation

47 releases (1 stable)

1.0.0 Nov 16, 2023
0.6.5 Oct 9, 2023
0.6.4 Sep 24, 2023
0.6.1 Jul 12, 2023
0.2.1 Mar 29, 2020

#9 in Profiling

Download history 154/week @ 2023-08-14 173/week @ 2023-08-21 268/week @ 2023-08-28 251/week @ 2023-09-04 139/week @ 2023-09-11 208/week @ 2023-09-18 216/week @ 2023-09-25 103/week @ 2023-10-02 203/week @ 2023-10-09 78/week @ 2023-10-16 113/week @ 2023-10-23 130/week @ 2023-10-30 89/week @ 2023-11-06 214/week @ 2023-11-13 159/week @ 2023-11-20 200/week @ 2023-11-27

673 downloads per month

MIT license

3.5K SLoC

oha (おはよう)

GitHub Actions Crates.io Arch Linux Homebrew Gitter

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.



This program is built on stable Rust.

cargo install oha

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

cargo install --no-default-features --features rustls oha

On Arch Linux

pacman -S oha

On macOS (Homebrew)

brew install 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


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


-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 [FLAGS] [OPTIONS] <url>

  <URL>  Target URL.

  -n <N_REQUESTS>                     Number of requests to run. [default: 200]
  -c <N_CONNECTIONS>                  Number of connections to run concurrently. You may should increase limit to number of open files for larger `-c`. [default: 50]
  -p <N_HTTP2_PARALLEL>               Number of parallel requests to send on HTTP/2. `oha` will run c * p concurrent workers in total. [default: 1]
  -z <DURATION>                       Duration of application to send requests. If duration is specified, n is ignored.
                                      Examples: -z 10s -z 3m.
  -q <QUERY_PER_SECOND>               Rate limit for all, in queries per second (QPS)
      --burst-delay <BURST_DURATION>  Introduce delay between a predefined number of requests.
                                      Note: If qps is specified, burst will be ignored
      --burst-rate <BURST_REQUESTS>   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.[a-z][a-z][0-9]. Currently dynamic scheme, host and port with keep-alive are not works well. See https://docs.rs/rand_regex/latest/rand_regex/struct.Regex.html for details of syntax.
      --max-repeat <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]
      --latency-correction            Correct latency to avoid coordinated omission problem. It's ignored if -q is not set.
      --no-tui                        No realtime tui
  -j, --json                          Print results as JSON
      --fps <FPS>                     Frame per second for tui. [default: 16]
  -m, --method <METHOD>               HTTP method [default: GET]
  -H <HEADERS>                        Custom HTTP header. Examples: -H "foo: bar"
  -t <TIMEOUT>                        Timeout for each request. Default to infinite.
  -A <ACCEPT_HEADER>                  HTTP Accept Header.
  -d <BODY_STRING>                    HTTP request body.
  -D <BODY_PATH>                      HTTP request body from file.
  -T <CONTENT_TYPE>                   Content-Type.
  -a <BASIC_AUTH>                     Basic authentication, username:password
      --http-version <HTTP_VERSION>   HTTP version. Available values 0.9, 1.0, 1.1.
      --http2                         Use HTTP/2. Shorthand for --http-version=2
      --host <HOST>                   HTTP Host header
      --disable-compression           Disable compression.
  -r, --redirect <REDIRECT>           Limit for number of Redirect. Set 0 for no redirection. Redirection isn't supported for HTTP/2. [default: 10]
      --disable-keepalive             Disable keep-alive, prevents re-use of TCP connections between different HTTP requests. This isn't supported for HTTP/2.
      --ipv6                          Lookup only ipv6.
      --ipv4                          Lookup only ipv4.
      --insecure                      Accept invalid certs.
      --connect-to <CONNECT_TO>       Override DNS resolution and default port numbers with strings like 'example.org:443:localhost:8443'
      --disable-color                 Disable the color scheme.
      --unix-socket <UNIX_SOCKET>     Connect to a unix socket instead of the domain in the URL. Only for non-HTTPS URLs.
      --stats-success-breakdown       Include a response status code successful or not successful breakdown for the time histogram and distribution statistics
  -h, --help                          Print help
  -V, --version                       Print version


Stress test in more realistic condition

oha uses default options inherited from rakyll/hey but you may need to change options to stress test in more realistic condition.

I suggest to run oha with following options.

oha <-z or -n> -c <number of concurrent connections> -q <query per seconds> --latency-correction --disable-keepalive <target-address>
  • --disable-keepalive

    In real, user doesn't query same URL using Keep-Alive. You may want to run without Keep-Alive.

  • --latency-correction

    You can avoid Coordinated Omission Problem by using --latency-correction.

Burst feature

You can use --burst-delay along with --burst-rate option to introduce delay between a defined number of requests.

oha -n 10 --burst-delay 2s --burst-rate 4

In this particular scenario, every 2 seconds, 4 requests will be processed, and after 6s the total of 10 requests will be processed. NOTE: If you don't set --burst-rate option, the amount is default to 1

Dynamic url feature

You can use --rand-regex-url option to generate random url for each connection.

oha --rand-regex-url[a-z][a-z][0-9]

Each Urls are generated by rand_regex crate but regex's dot is disabled since it's not useful for this purpose and it's very incovenient if url's dots are interpreted as regex's dot.

Optionaly you can set --max-repeat option to limit max repeat count for each regex. e.g[a-z]* with --max-repeat 4 will generate url like[a-z]{0,4}

Currently dynamic scheme, host and port with keep-alive are not works well.


Feel free to help us!

Here are some issues to improving.

  • Write tests
  • Improve tui design.
    • Show more information?
    • There are no color in realtime tui now. I want help from someone who has some color sense.
  • Improve speed
    • I'm new to tokio. I think there are some space to optimize query scheduling.
  • Output like CSV or JSON format.
  • Improve histogram in summary output
    • It uses very simple algorithm now.


~740K SLoC