Generate HTTP load and plot the results in real-time

ali

codecov.io Code Coverage Release Go Doc

A load testing tool capable of performing real-time analysis, inspired by vegeta and jplot.

Screenshot

ali comes with an embedded terminal-based UI where you can plot the metrics in real-time, so lets you perform real-time analysis on the terminal.

Installation

Binary releases are available through here.

Via Homebrew

brew install nakabonne/ali/ali

Via APT

wget https://github.com/nakabonne/ali/releases/download/v0.5.4/ali_0.5.4_linux_amd64.deb
apt install ./ali_0.5.4_linux_amd64.deb

Via RPM

rpm -ivh https://github.com/nakabonne/ali/releases/download/v0.5.4/ali_0.5.4_linux_amd64.rpm

Via Pacman

pacman -S ali

Via Go

Note that you may have a problem because it downloads an untagged binary.

go get github.com/nakabonne/ali

Via Docker

docker run --rm -it nakabonne/ali ali

Usage

Quickstart

ali http://host.xz

Replace http://host.xz with the target you want to issue the requests to. Press Enter when the UI appears, then the attack will be launched with default options (rate=50, duration=10s).

Options

ali -h
Usage:
  ali [flags] 

Flags:
  -b, --body string         A request body to be sent.
  -B, --body-file string    The path to file whose content will be set as the http request body.
  -c, --connections int     Amount of maximum open idle connections per target host (default 10000)
      --debug               Run in debug mode.
  -d, --duration duration   The amount of time to issue requests to the targets. Give 0s for an infinite attack. (default 10s)
  -H, --header strings      A request header to be sent. Can be used multiple times to send multiple headers.
      --local-addr string   Local IP address. (default "0.0.0.0")
  -M, --max-body int        Max bytes to capture from response bodies. Give -1 for no limit. (default -1)
  -W, --max-workers uint    Amount of maximum workers to spawn. (default 18446744073709551615)
  -m, --method string       An HTTP request method for each request. (default "GET")
      --no-http2            Don't issue HTTP/2 requests to servers which support it.
  -K, --no-keepalive        Don't use HTTP persistent connection.
  -r, --rate int            The request rate per second to issue against the targets. Give 0 then it will send requests as fast as possible. (default 50)
      --resolvers string    Custom DNS resolver addresses; comma-separated list.
  -t, --timeout duration    The timeout for each request. 0s means to disable timeouts. (default 30s)
  -v, --version             Print the current version.
  -w, --workers uint        Amount of initial workers to spawn. (default 10)

Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

Examples

For basic usage:

ali --rate=500 --duration=5m http://host.xz

For an infinite attack:

ali --duration=0 http://host.xz

For an attack with the POST method:

ali --body-file=/path/to/foo.json --method=POST http://host.xz

Charts

Press l (or h) to switch the displayed chart. On all charts, you can click and drag to select a region to zoom into.

Latency

Screenshot

The X-axis represents the request counts and the Y-axis represents latencies in milliseconds.

Percentiles

Screenshot

You can see how the 50th, 90th, 95th, and 99th percentiles are changing.

Bytes

TBA

Histogram

TBA

Features

Plot in real-time

Screenshot

Visualize the attack progress

This will help you during long tests.

Screenshot

Mouse support

With the help of mum4k/termdash can be used intuitively.

Screenshot

Acknowledgements

This project would not have been possible without the effort of many individuals and projects but especially vegeta for the inspiration and powerful API. Besides, ali is built with termdash (as well as termbox-go) for the rendering of all those fancy graphs on the terminal. They clearly stimulated an incentive to creation. A big "thank you!" goes out to all those who helped.

Owner
Comments
  • fix panic when doing Ctrl-C in the middle of a attack

    fix panic when doing Ctrl-C in the middle of a attack

    this should fix #23.

    As the Attack method is now sending messages to the 'metricsCh', and it looks at the Context being complete (completely stopping the attack), I simply removed the channel send that was being done to metricsCh in gui/keybinds.go . This fixed the panic and the Ctrl-C issue for me.

  • Unable to install with

    Unable to install with "brew install nakabonne/ali/ali"

    I noticed this when installing:

    $ brew install nakabonne/ali/ali
    ==> Tapping nakabonne/ali
    Cloning into '/usr/local/Homebrew/Library/Taps/nakabonne/homebrew-ali'...
    remote: Enumerating objects: 39, done.
    remote: Counting objects: 100% (39/39), done.
    remote: Compressing objects: 100% (26/26), done.
    remote: Total 39 (delta 13), reused 0 (delta 0), pack-reused 0
    Receiving objects: 100% (39/39), 6.26 KiB | 6.26 MiB/s, done.
    Resolving deltas: 100% (13/13), done.
    Tapped 1 formula (26 files, 33.6KB).
    Error: No available formula or cask with the name "nakabonne/ali/ali".
    ==> Searching for similarly named formulae...
    This similarly named formula was found:
    ali
    To install it, run:
      brew install ali
    ~ ⌚ 9:02:48
    $ brew install ali              
    ==> Installing ali from nakabonne/ali
    ==> Downloading https://github.com/nakabonne/ali/releases/download/v0.3.3/ali_0.3.3_darwin_amd64.tar.gz
    ==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/294836885/d0365a80-0
    ######################################################################## 100.0%
    🍺  /usr/local/Cellar/ali/0.3.3: 5 files, 6.2MB, built in 2 seconds
    ```
    `
  • Requestparameter as cli options

    Requestparameter as cli options

    Hey,

    please add the feature to add cli options for the http(s) requests like ali --targeturl=http://www.foo.bar --duration=10 --timeout=30 an so on. Thank you.

  • Fix brew install command

    Fix brew install command

    Docs suggest brew install nakabonne/ali/ali however Homebrew responds with an error, I believe the correct series of commands is brew tap nakabonne/ali followed by brew install ali

    brew install nakabonne/ali/ali
    ==> Tapping nakabonne/ali
    Cloning into '/usr/local/Homebrew/Library/Taps/nakabonne/homebrew-ali'...
    Error: No available formula or cask with the name "nakabonne/ali/ali".
    ==> Searching for similarly named formulae...
    This similarly named formula was found:
    ali
    To install it, run:
      brew install ali
    brew install ali
    ==> Installing ali from nakabonne/ali
    
  • Plot more metrics in real-time

    Plot more metrics in real-time

    It would be nice if it's able to press Ctrl-i to switch between charts.

    • [x] Plot 50th, 90th, 95th, and 99th percentiles #66
    • [ ] Bytes In and Bytes Out
    • [ ] Status Codes
    • [ ] Histogram #63
    • [ ] ~Workers running in concurrent~
  • Header values containing comma won't work

    Header values containing comma won't work

    First of all: Thanks heaps for this wonderful tool. I am absolutely loving it. Great work, thanks!

    I just noticed headers are declared as StringSliceVarP:

    flagSet.StringSliceVarP(&c.headers, "header", "H", []string{}, "A request header to be sent. Can be used multiple times to send multiple headers.")

    Why allow comma separated values within the --header flag? I think for header values it's a common use case to have them contain a comma separated list of values (i.e. user groups).

    Solution: Switch to StringArrayVarP and force users to supply multiple --header flags to define all header fields.

    So instead of:

    ali --header "key1:value1,key2:value2"
    

    Use this:

    ali --header "groups:group1,group2,group3" --header "user:username"
    

    What do you think?

  • Panic when running at high rate

    Panic when running at high rate

    What's happened

    ali -r 0 -d 2s http://host.xz
    

    Then: image

    Possible Causes

    It's probably due to the time it takes to draw to all the charts. Maybe we should each spawn goroutine. https://github.com/nakabonne/ali/blob/2711e42b6d038296c100fd2e8a0fdf0ce84996af/gui/drawer.go#L66-L84

  • percentiles chart

    percentiles chart

    This PR adds percentiles chart support, which can be enabled with Ctrl-(P) ercentiles.

    You can change to latencies chart again Latencies chart with Ctrl-(L) atencies.

    As I'm not sure we're "hiding" this functionality under a shortcut, I did not update the README yet.

    Added a utility function to create charts with legends. (preparing for bytes-in/bytes-out or any other metric) Added a utility type so we can easily create charts with legends (chartLegend)

    Although it's working correctly, I few like there are a few improvements that can be made (specially in gui/gui.go).

    This PR also fixes a few issues I noticed while using ali:

    • Percentiles (text) where not being updated correctly. This was happening because vegeta.Metrics only set P50/90... when (*vegeta.Metrics).Close() is called. I modified newMetrics to calculate quantiles as newMetrics is called.
    • Also fixed the handling of chartCh and metrics. The way it was, it could not calculate floating point values (as when appending it calculated value/time.Millisecond. As time.Millisecond is an int64, it means everything was being rounded to either 0s or 1.0s), not allowing us to calculate 500ms as 0.5s.

    It also allows texts to be customized (with cellColors - this is necessary because of Legends, which we want to have the same color as its own Series).

    This is how it looks: image

    I feel like adding values to charts is way too manual, at the moment. Perhaps adding a type that holds a function which extracts metrics (from vegeta.Metrics) to a lineChart is a good idea?

  • Workaround race contition in drawer.redrawMetrics()

    Workaround race contition in drawer.redrawMetrics()

    This is my current workaround I am using for the issue #111 (fatal error: concurrent map iteration and map write) to guard against concurrent access to the shared map StatusCodes accross ali and its library tsenart/vegeta

  • Support HTTP2 option

    Support HTTP2 option

    This PR makes it possible to switch to send HTTP/2 requests when supported by the server. Also found that connections is not passed to the attacker.Options struct while rebasing, fixed that as well :smiley:

    Added a flag --http2 for switching to HTTP/2

    mayadata:ali$ ./ali --help
    Usage:
      ali [flags] <target URL>
    
    Flags:
      -b, --body string         A request body to be sent.
      -B, --body-file string    The path to file whose content will be set as the http request body.
      -c, --connections int     Amount of maximum open idle connections per target host (default 10000
          --debug               Run in debug mode.
      -d, --duration duration   The amount of time to issue requests to the targets. Give 0s for an infinite attack. (default 10s)
      -H, --header strings      A request header to be sent. Can be used multiple times to send multiple headers.
          --http2               Issue HTTP/2 requests to servers which support it. (default true) (default true)
      -k, --keepalive           Use HTTP persistent connection. (default true)
      -M, --max-body int        Max bytes to capture from response bodies. Give -1 for no limit. (default -1)
      -W, --max-workers uint    Amount of maximum workers to spawn. (default 18446744073709551615)
      -m, --method string       An HTTP request method for each request. (default "GET")
      -r, --rate int            The request rate per second to issue against the targets. Give 0 then it will send requests as fast as possible. (default 50)
      -t, --timeout duration    The timeout for each request. 0s means to disable timeouts. (default 30s)
      -v, --version             Print the current version.
      -w, --workers uint        Amount of initial workers to spawn. (default 10)
    
    Examples:
      ali --duration=10m --rate=100 http://host.xz
    
    Author:
      Ryo Nakao <[email protected]>
    
  • zoom: undo with right click?

    zoom: undo with right click?

    Took me sometime to notice we can undo a Zoom with the mouse scroll (why? Not sure. Perhaps documentation in the README will do), but I thought that we can simulate zoom-outs with a mouse right click.

    Does it make sense to you? (Zoom in with selection; zoom out with right click)

  • Set --max-workers required in parameters + tip performance

    Set --max-workers required in parameters + tip performance

    Hello! https://github.com/nakabonne/ali/blob/e3f49a43534500bac198f5dc9172bf2723e37bbe/attacker/attacker.go#L25

    After performing several tests, I found that if this parameter "--max-workers" is not passed, there is some severe performance penalty.

    How I discovered the performance issue: Without passing the "-W" as a parameter and benchmarking a powerful web server on my own local machine, I gradually increased the requests per second until I was limited to around 10k req/s due to performance issues: Ali crashed and the graphs showed that my server's latency was only going up! However... On the other hand the "wrk" tool was handling more than 80k req/s so the problem was not in my web server.

    I decided start the ali benchmark again by setting the "-W" to 10 and gradually increased both the rate (-r) and the max-workers until I understood that on my machine the maximum request that each worker could handle was around 1000 req / worker. So I tested it and in every time that I didn't set the max-workers the benchmark crashed after 10k/sec and in every time that I set the max-workers ali ran smoothly.

    Then, using the command: ali -r 25000 -d 15s -W 25 http://localhost:8080/

    The 10k/sec bottleneck was avoided until reaching the intended 25k/sec in the command.

    The tip performance then is:

    1. Never run ali without defining the -W param and gradually increase the max number of workers so you can understand the rate of requests / worker needed to reach the rate you want and avoid this bug..
    2. To max performance set --redraw-interval 1000ms too.

    For the dev team: Set max-workers as required in params or min 10 max-workers and max -> if rate > 1000 then max-workers = rate / 1000 (rounded).

  • Add Step increase feature

    Add Step increase feature

    A way to give it a Step Period and Step Rate. Example:

    --step-period 30m --step-rate-increase 1000 --max-requests 20000

    So you can increase the rate every 30 minutes by 1000 requests. Metrics can settle during the step period and the slow increase of requests can let you know the tipping point of you application. The max requests can have no ceiling by default.

  • Graph does not show all requests

    Graph does not show all requests

    When the request number is very big, Ali shows graph of partial data. See the below screenshot, it's showing 14707 requests out of 75000 in histogram.

    Screen Shot 2022-03-05 at 9 36 11 AM

    Also, how to make ali wait for requests to finish after the duration? Seems like ali just exits as soon as the duration ends.

Real-time HTTP Intrusion Detection
Real-time HTTP Intrusion Detection

teler Real-time HTTP Intrusion Detection Contribute · What's new · Report Bug · Request Feature teler is an real-time intrusion detection and threat a

Jan 5, 2023
Lightweight http response time based load balancer written in Go

HTTP Load Balancer Specifications http servers should always return time taken to proceed request in headers as EXECUTION_TIME in ms this load balance

Feb 22, 2022
PinGo is a standalone and feature-rich tool for common IP-based reachability checking tasks. Ping or Trace and Observe in real-time the statistics.

pingo As a network champion from designing and implementing to troubleshooting large scale networks - I know that is usually not easy for administrato

Sep 26, 2022
A Realtime API Gateway used with NATS to build REST, real time, and RPC APIs, where all your clients are synchronized seamlessly.
A Realtime API Gateway used with NATS to build REST, real time, and RPC APIs, where all your clients are synchronized seamlessly.

Realtime API Gateway Synchronize Your Clients Visit Resgate.io for guides, live demos, and resources. Resgate is a Go project implementing a realtime

Dec 31, 2022
SubCenter is a middleware that integrate task subscriptions and real-time push

Subscription Center SubCenter是一个集成各种任务并进行实时推送的中间件,本身不提供数据与推送服务。

Oct 31, 2022
Go-random-chat - Fast and scalable real-time random chat written in go
Go-random-chat - Fast and scalable real-time random chat written in go

Go Random Chat Fast and scalable real-time random chat written in go. Features:

Dec 21, 2022
Walrus 🕑 Real-time event streaming platform built on top of gRPC streams
Walrus 🕑 Real-time event streaming platform built on top of gRPC streams

Walrus ?? Real-time event streaming platform built on top of gRPC streams Table of Contents About the project Built With How it works Getting Started

Sep 24, 2022
Schema-free, document-oriented streaming database that optimized for monitoring network traffic in real-time

Basenine Schema-free, document-oriented streaming database that optimized for monitoring network traffic in real-time. Featured Aspects Has the fastes

Nov 2, 2022
Jswhois - Whois lookup results in json format

jswhois -- whois lookup results in json format jswhois(1) is a tool to look up a

Nov 30, 2022
Go http real ip header parser

remoteaddr Go http real ip header parser module A forwarders such as a reverse proxy or Cloudflare find the real IP address from the requests made to

Nov 18, 2022
Ephemeral One Time/Build-Time gRPC TLS PKI system.

PkiSauce Ephemeral Build Time TLS PKI saucing for your intra services GRPC (or not) communications. Description A simple attempt to avoid deploying co

Jul 4, 2022
Generate types and service clients from protobuf definitions annotated with http rules.

protoc-gen-typescript-http Generates Typescript types and service clients from protobuf definitions annotated with http rules. The generated types fol

Nov 22, 2022
Laptop Booking Application in Golang and gRPC, load-balancing with NGINX, and fully compatible with HTTPS OpenAPI v3

Laptop Booking Application in Golang and gRPC Goals GitHub CI & Coverage Badge Serialize protobuf messages Create laptop unary gRPC Search laptop Serv

Jun 17, 2022
Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator
Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator

Trickster is an HTTP reverse proxy/cache for http applications and a dashboard query accelerator for time series databases. Learn more below, and chec

Jan 2, 2023
Demo of EdgeX Foundry Ireland (or Jakarta) release with real Modbus, SNMP and GPIO pin devices

Ireland Demo This demo shows the Ireland (or Jakarta - it works for both) release of EdgeX with the following devices: Comet Systems T0310 temperature

Nov 6, 2021
Simple, fast and scalable golang rpc library for high load

gorpc Simple, fast and scalable golang RPC library for high load and microservices. Gorpc provides the following features useful for highly loaded pro

Dec 19, 2022
High-performance PHP application server, load-balancer and process manager written in Golang
High-performance PHP application server, load-balancer and process manager written in Golang

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a serv

Jan 1, 2023