Giter VIP home page Giter VIP logo

oha's Introduction

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 tui-rs.

demo

Installation

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 http://packages.azlux.fr/debian/ buster main" | sudo tee /etc/apt/sources.list.d/azlux.list
wget -qO - https://azlux.fr/repo.gpg.key | sudo apt-key add -
apt update
apt install oha

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

Arguments:
  <URL>  Target URL.

Options:
  -n <N_REQUESTS>                    Number of requests to run. [default: 200]
  -c <N_WORKERS>                     Number of workers to run concurrently. You may should increase limit to number of open files for larger `-c`. [default: 50]
  -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)
      --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, 2.
      --host <HOST>                  HTTP Host header
      --disable-compression          Disable compression.
  -r, --redirect <REDIRECT>          Limit for number of Redirect. Set 0 for no redirection. [default: 10]
      --disable-keepalive            Disable keep-alive, prevents re-use of TCP connections between different HTTP requests.
      --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.
  -h, --help                         Print help
  -V, --version                      Print version

Tips

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.

Contribution

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.

oha's People

Contributors

akiradeveloper avatar chipsenkbeil avatar dmitry-j-mikhin avatar equal-l2 avatar fasterthanlime avatar hatoo avatar jtk18 avatar kianmeng avatar kngwyu avatar messense avatar senden9 avatar shirshak55 avatar stefankreutz avatar svenstaro avatar togatoga avatar wjhoward avatar yiblet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.