Coder Social home page Coder Social logo

nakabonne / ali Goto Github PK

View Code? Open in Web Editor NEW
3.6K 35.0 139.0 35.78 MB

Generate HTTP load and plot the results in real-time

License: MIT License

Go 99.63% Dockerfile 0.06% Makefile 0.31%
load-testing benchmarking testing-tools tui go visualization monitoring

ali's Introduction

ali

Release Go Reference

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 MacPorts

sudo port selfupdate
sudo port install ali

Via APT

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

Via RPM

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

Via Pacman

pacman -S ali

Via APK

After enabling the community repo:

apk add ali

Via Go

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

go install github.com/nakabonne/ali@latest

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] <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.
      --cacert string              PEM ca certificate file
      --cert string                PEM encoded tls certificate file to use
  -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 stringArray         A request header to be sent. Can be used multiple times to send multiple headers.
      --insecure                   Skip TLS verification
      --key string                 PEM encoded tls private key file to use
      --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.
      --query-range duration       The results within the given time range will be drawn on the charts (default 30s)
  -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)
      --redraw-interval duration   The time interval to redraw charts (default 250ms)
      --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)

Examples:
  ali --duration=10m --rate=100 http://host.xz

Author:
  Ryo Nakao <[email protected]>

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.

ali's People

Contributors

boggyhole avatar brenol avatar cvhariharan avatar cxsu avatar fedorlitau avatar fsmiamoto avatar hazcod avatar herbygillot avatar ilmanzo avatar matsuyoshi30 avatar nakabonne avatar orhun avatar rzkmak avatar shubham14bajpai avatar testwill avatar xsteadfastx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ali's Issues

How does DNS resoluton work?

I’d like to map a few domains/hosts to certain IP address, e.g. to load test a new server. I tried the following things:

  • docker run --rm -it --add-host example.com:10.0.0.1 nakabonne/ali ali example.com
  • docker run --rm -it -v $(pwd)/hosts:/etc/hosts nakabonne/ali ali example.com with a custom hosts file mapped into the container
  • docker run --rm -it --network=host nakabonne/ali ali example.com with a modified hosts file on the docker host

but none of the above worked for me. Instead, ali would always hit the original server.

fix issue with percentiles chart navigation

OK, so this one is actually weird.

From the point of view of code, the current implementation is correct.

From the point of view of usability, though, it's incorrect.

As the first chart in ali is latencyChart, pressing L the first time does not change to the next chart, which is percentiles.
This problem does not happen with backwards button (H), and is easily fixed with changing start position to 0 (which is a fact).

I'm finishing a PR that will fix this problem.

featreq: support for multiple URLs

It would be nice to be able to specify a list of URLs to send traffic to.

Not sure how best to handle the division of URLs vs traffic, but for my personal needs a simple round-robin across the URLs would work. I.e. with 2 URLs: request1 -> url1, request2 -> url2, request3 -> url1, request4 -> url2, etc.

Status codes are out of order

What's happened
When more than one status code (and errors) is reported, the order is not constant and could be replaced at irregular intervals.
order

Cause
Since the map is iterated to build a string.

ali/gui/drawer.go

Lines 217 to 230 in 1329145

// TODO: Guaranteed to be in order.
codesText := ""
for code, n := range m.StatusCodes {
codesText += fmt.Sprintf(`%q: %d
`, code, n)
}
d.widgets.statusCodesText.Write(codesText, text.WriteReplace())
errorsText := ""
for _, e := range m.Errors {
errorsText += fmt.Sprintf(`- %s
`, e)
}
d.widgets.errorsText.Write(errorsText, text.WriteReplace())

Natively support specifying HTTP proxies

I've had very mixed results for some reason specifying the environment variable HTTP_PROXY to Ali.
Not sure if this is related, but it would be nice to natively support supplying a proxy via an argument.

e.g. curl uses -x.

Support resolvers option

It would be nice to have the option which specifies the list of custom DNS resolver addresses (comma-separated list). Maybe It works only on non Windows systems.

Example:

ali --resolvers="1.2.3.4,192.168.11.1:53" http:host.xz

We can borrow around here.

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
```
`

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)

modify others text for better reading

This is actually a question.

Perhaps Earliest/Latest/End shouldn't use String() for a time.Time. It gets noisy when you have a timezone (because of Monotonic):
image

Perhaps we can use time.RFC3339Nano?

image

Or some middleground, without the T:
image

Or without millis/nanos:
image

Or without millis/nanos and aligned:
image

Or with millis/nanos, aligned, without monotonic:
image

And (I know I'm talking mostly about date but...) with everything aligned:
image

"high" CPU usage while idle

it's using 20% CPU while idle here (because of termdash.RedrawInterval).

Perhaps we can use termdash.NewController and only redraw after 250ms, while its running (this will probably bring a lot of complexity?)?

Concurrent requests

Excuse me?

How does this tool test 500 concurrent requests for URLs? You need to look at those parameters

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.

panic: runtime error: slice bounds out of range [6:1]

This bug occurs some times more or less randomly producing the following message:

panic: runtime error: slice bounds out of range [6:1]

goroutine 53 [running]:in:

github.com/nakabonne/tstorage.(*memoryMetric).selectPoints(0xc0001ba7e0, 0x16a06b537e57044c, 0x16a06b5a7a7ab04c, 0x0, 0x0, 0x0)
        /root/go/pkg/mod/github.com/nakabonne/[email protected]/memory_partition.go:232 +0x27b
github.com/nakabonne/tstorage.(*memoryPartition).selectDataPoints(0xc000132200, 0x82dbf7, 0x7, 0x0, 0x0, 0x0, 0x16a06b537e57044c, 0x16a06b5a7a7ab04c, 0x449a4c, 0xc000092238, ...)
        /root/go/pkg/mod/github.com/nakabonne/[email protected]/memory_partition.go:124 +0x9e
github.com/nakabonne/tstorage.(*storage).Select(0xc000132180, 0x82dbf7, 0x7, 0x0, 0x0, 0x0, 0x16a06b537e57044c, 0x16a06b5a7a7ab04c, 0x46a77b, 0x77b3455e6fa8, ...)
        /root/go/pkg/mod/github.com/nakabonne/[email protected]/storage.go:324 +0x262
github.com/nakabonne/ali/storage.(*storage).Select(0xc00012e260, 0x82dbf7, 0x7, 0xc043adf3db12ae4c, 0x323d8539, 0xb456e0, 0xc043adfb5b12ae4c, 0x72e613139, 0xb456e0, 0x0, ...)
        /opt/ali/storage/storage.go:116 +0x105
github.com/nakabonne/ali/gui.(*drawer).redrawCharts(0xc0001c6480, 0x8a5ab8, 0xc00007e000)
        /opt/ali/gui/drawer.go:53 +0x262
created by github.com/nakabonne/ali/gui.attack
        /opt/ali/gui/keybinds.go:55 +0x9d

I have opened a PR in the underlying library to fix it - see nakabonne/tstorage#30

Support connections options

  • Enable to specify maximum open idle connections per target host by giving -cor --connections

Only tiny changes are required because all we have to do is just pass to the Vegeta API.

Support max body option

  • Enable to set maximum number of bytes to capture from response bodies, by giving -B or --max-body.

Only tiny changes are required because all we have to do is just pass to the Vegeta API.

Better input fields

To support more options, need to be expandable.

  • Make a modal or something else
    • Using another container makes it complicated
  • Make it possible to move fields with the Tab key.

Support keepalive options

  • Enable to switch to use persistent connections

Only tiny changes are required because all we have to do is just pass to the Vegeta API.

Plot more metrics in real-time

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

  • Plot 50th, 90th, 95th, and 99th percentiles #66
  • Bytes In and Bytes Out
  • Status Codes
  • Histogram #63
  • Workers running in concurrent

go test fails

$ go test
# github.com/nakabonne/ali
./main.go:32:3: Fprintln arg list ends with redundant newline
FAIL    github.com/nakabonne/ali [build failed]

Vegeta causes panic at high rates

Run the following:

ali -r 1000 http://host.xz

Then panic occurred.
The noteworthy stack traces are:

  • tsenart/vegeta/v12/lib/attack.go:340
  • tsenart/vegeta/v12/lib/attack.go:312

image

Export Functionality

Would love some export functionality of all the data that is collected.

Simplest export would be a "CSV" file where each line is latency & start time of each request in order they were made.

Eventually we could expand this to include other things about the request like the response size, start timestamps, number of request there were in parallel when you started it etc.

I don't want to export processed data. Since they're fairly basic calculations I don't think that weight should fall on this tool; as it is not its main focus.

Scrolling Issue on Info Boxes at Bottom

I ran some tests and the results are too large for the bottom boxes to appear. However the scrolling with mouse or up-down keys doesn't work. This is broken for all boxes at the bottom.
Is it a problem on the UI library? In that case I'll make an issue there if you can tell me which repo.

See below.
SS 2021-03-11T18 40 21

IMO they should also have higher weight when layout-ing so they're not such a small part of graph.

It would be best UX wise to be able to maximise both graph or the boxes at the bottom for further inspection.

How to post diffrent data?

ali -H "Accept: application/json" -H "Content-type: application/json" \ -m "POST" \ -b '{"name":"xxx"}'

now i want to send some diffrent data peer request, What shall I do?

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?

Histogram bar chart

Give buckets as:

ali --buckets "1ms, 10ms, 100ms, 500ms" http://host.xz

Then drawn as a bar chart:

image

https://github.com/mum4k/termdash/blob/master/doc/images/barchartdemo.gif

More... (TBD)

it may be helpful to appear on the others widget:

0~1ms: 1 25%
1ms~10ms: 1 25%
10ms~100ms: 1 25%
100ms~500ms: 1 25%

Suppose there's an SLA that says 95% of requests must be returned within 500ms. It would be helpful.

TODO:

  • Make it capable of giving histogram buckets from comma-separated args. (#68)
  • Add bar chart which draw histogram buckets

support multiple headers

Love this project. I'm already starting to work on multiple headers and I'll open a PR soon if you have no problem with this functionality.

Data race in termdash

What's happened

Whenever we do:

  • running with -race option
  • Attack with Enter
  • Quit with Ctrl-C

A data race has been detected as shown below:

go run -race main.go http://host.xz

==================
WARNING: DATA RACE
Write at 0x00c00013c5b0 by main goroutine:
  internal/poll.(*FD).destroy()
      /usr/local/Cellar/go/1.15.1/libexec/src/internal/poll/fd_unix.go:78 +0xc4
  internal/poll.(*FD).decref()
      /usr/local/Cellar/go/1.15.1/libexec/src/internal/poll/fd_mutex.go:213 +0x53
  internal/poll.(*FD).Close()
      /usr/local/Cellar/go/1.15.1/libexec/src/internal/poll/fd_unix.go:99 +0x79
  os.(*file).close()
      /usr/local/Cellar/go/1.15.1/libexec/src/os/file_unix.go:235 +0x76
  os.(*File).Close()
      /usr/local/Cellar/go/1.15.1/libexec/src/os/file_posix.go:25 +0x567
  github.com/nsf/termbox-go.Close()
      /Users/nakabonne/go/pkg/mod/github.com/nsf/[email protected]/api.go:142 +0x525
  github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/terminal/termbox/termbox.go:163 +0x55
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104

Previous read at 0x00c00013c5b0 by goroutine 18:
  [failed to restore the stack]

Goroutine 18 (running) created at:
  github.com/mum4k/termdash/private/event.newSubscriber()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:89 +0x3cf
  github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:237 +0x224
  github.com/mum4k/termdash.(*termdash).subscribers()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:226 +0x4ce
  github.com/mum4k/termdash.newTermdash()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:206 +0x2ec
  github.com/mum4k/termdash.Run()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:106 +0x7a
  github.com/nakabonne/ali/gui.run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018accf0 by main goroutine:
  github.com/nsf/termbox-go.Close()
      /Users/nakabonne/go/pkg/mod/github.com/nsf/[email protected]/api.go:146 +0x597
  github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/terminal/termbox/termbox.go:163 +0x55
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104

Previous read at 0x0000018accf0 by goroutine 18:
  [failed to restore the stack]

Goroutine 18 (running) created at:
  github.com/mum4k/termdash/private/event.newSubscriber()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:89 +0x3cf
  github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:237 +0x224
  github.com/mum4k/termdash.(*termdash).subscribers()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:226 +0x4ce
  github.com/mum4k/termdash.newTermdash()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:206 +0x2ec
  github.com/mum4k/termdash.Run()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:106 +0x7a
  github.com/nakabonne/ali/gui.run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018acce8 by main goroutine:
  github.com/nsf/termbox-go.Close()
      /Users/nakabonne/go/pkg/mod/github.com/nsf/[email protected]/api.go:147 +0x5b2
  github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/terminal/termbox/termbox.go:163 +0x55
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104

Previous read at 0x0000018acce8 by goroutine 18:
  [failed to restore the stack]

Goroutine 18 (running) created at:
  github.com/mum4k/termdash/private/event.newSubscriber()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:89 +0x3cf
  github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:237 +0x224
  github.com/mum4k/termdash.(*termdash).subscribers()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:226 +0x4ce
  github.com/mum4k/termdash.newTermdash()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:206 +0x2ec
  github.com/mum4k/termdash.Run()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:106 +0x7a
  github.com/nakabonne/ali/gui.run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x000001879530 by main goroutine:
  github.com/nsf/termbox-go.Close()
      /Users/nakabonne/go/pkg/mod/github.com/nsf/[email protected]/api.go:149 +0x5e8
  github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/terminal/termbox/termbox.go:163 +0x55
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104

Previous read at 0x000001879530 by goroutine 18:
  [failed to restore the stack]

Goroutine 18 (running) created at:
  github.com/mum4k/termdash/private/event.newSubscriber()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:89 +0x3cf
  github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:237 +0x224
  github.com/mum4k/termdash.(*termdash).subscribers()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:226 +0x4ce
  github.com/mum4k/termdash.newTermdash()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:206 +0x2ec
  github.com/mum4k/termdash.Run()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:106 +0x7a
  github.com/nakabonne/ali/gui.run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018207b8 by main goroutine:
  github.com/nsf/termbox-go.Close()
      /Users/nakabonne/go/pkg/mod/github.com/nsf/[email protected]/api.go:153 +0x65d
  github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/terminal/termbox/termbox.go:163 +0x55
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104

Previous write at 0x0000018207b8 by goroutine 18:
  [failed to restore the stack]

Goroutine 18 (running) created at:
  github.com/mum4k/termdash/private/event.newSubscriber()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:89 +0x3cf
  github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:237 +0x224
  github.com/mum4k/termdash.(*termdash).subscribers()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:226 +0x4ce
  github.com/mum4k/termdash.newTermdash()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:206 +0x2ec
  github.com/mum4k/termdash.Run()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:106 +0x7a
  github.com/nakabonne/ali/gui.run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018207c0 by main goroutine:
  github.com/nsf/termbox-go.Close()
      /Users/nakabonne/go/pkg/mod/github.com/nsf/[email protected]/api.go:154 +0x678
  github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/terminal/termbox/termbox.go:163 +0x55
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104

Previous write at 0x0000018207c0 by goroutine 18:
  [failed to restore the stack]

Goroutine 18 (running) created at:
  github.com/mum4k/termdash/private/event.newSubscriber()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:89 +0x3cf
  github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:237 +0x224
  github.com/mum4k/termdash.(*termdash).subscribers()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:226 +0x4ce
  github.com/mum4k/termdash.newTermdash()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:206 +0x2ec
  github.com/mum4k/termdash.Run()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:106 +0x7a
  github.com/nakabonne/ali/gui.run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018207a0 by main goroutine:
  github.com/nsf/termbox-go.Close()
      /Users/nakabonne/go/pkg/mod/github.com/nsf/[email protected]/api.go:155 +0x693
  github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/terminal/termbox/termbox.go:163 +0x55
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104

Previous read at 0x0000018207a0 by goroutine 18:
  github.com/nsf/termbox-go.Flush()
      /Users/nakabonne/go/pkg/mod/github.com/nsf/[email protected]/api.go:208 +0x773
  github.com/mum4k/termdash/terminal/termbox.(*Terminal).Flush()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/terminal/termbox/termbox.go:113 +0x2f
  github.com/mum4k/termdash.(*termdash).redraw()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:278 +0x1bd
  github.com/mum4k/termdash.(*termdash).evRedraw()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:294 +0xa6
  github.com/mum4k/termdash.(*termdash).subscribers.func3()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:230 +0x44
  github.com/mum4k/termdash/private/event.(*subscriber).callback()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:95 +0x5a
  github.com/mum4k/termdash/private/event.(*subscriber).run()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:110 +0xd2

Goroutine 18 (running) created at:
  github.com/mum4k/termdash/private/event.newSubscriber()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:89 +0x3cf
  github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:237 +0x224
  github.com/mum4k/termdash.(*termdash).subscribers()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:226 +0x4ce
  github.com/mum4k/termdash.newTermdash()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:206 +0x2ec
  github.com/mum4k/termdash.Run()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:106 +0x7a
  github.com/nakabonne/ali/gui.run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
==================
WARNING: DATA RACE
Write at 0x0000018207a8 by main goroutine:
  github.com/nsf/termbox-go.Close()
      /Users/nakabonne/go/pkg/mod/github.com/nsf/[email protected]/api.go:156 +0x6ae
  github.com/mum4k/termdash/terminal/termbox.(*Terminal).Close()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/terminal/termbox/termbox.go:163 +0x55
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x230
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104

Previous read at 0x0000018207a8 by goroutine 18:
  github.com/nsf/termbox-go.Flush()
      /Users/nakabonne/go/pkg/mod/github.com/nsf/[email protected]/api.go:208 +0x757
  github.com/mum4k/termdash/terminal/termbox.(*Terminal).Flush()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/terminal/termbox/termbox.go:113 +0x2f
  github.com/mum4k/termdash.(*termdash).redraw()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:278 +0x1bd
  github.com/mum4k/termdash.(*termdash).evRedraw()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:294 +0xa6
  github.com/mum4k/termdash.(*termdash).subscribers.func3()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:230 +0x44
  github.com/mum4k/termdash/private/event.(*subscriber).callback()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:95 +0x5a
  github.com/mum4k/termdash/private/event.(*subscriber).run()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:110 +0xd2

Goroutine 18 (running) created at:
  github.com/mum4k/termdash/private/event.newSubscriber()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:89 +0x3cf
  github.com/mum4k/termdash/private/event.(*DistributionSystem).Subscribe()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:237 +0x224
  github.com/mum4k/termdash.(*termdash).subscribers()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:226 +0x4ce
  github.com/mum4k/termdash.newTermdash()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:206 +0x2ec
  github.com/mum4k/termdash.Run()
      /Users/nakabonne/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:106 +0x7a
  github.com/nakabonne/ali/gui.run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:70 +0xa38
  github.com/nakabonne/ali/gui.Run()
      /Users/nakabonne/src/github.com/brenol/ali/gui/gui.go:34 +0x215
  main.(*cli).run()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:117 +0x26c
  main.main()
      /Users/nakabonne/src/github.com/brenol/ali/main.go:60 +0x104
==================
Found 8 data race(s)
exit status 66

reported at #66 (comment)

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.

ali/gui/drawer.go

Lines 66 to 84 in 2711e42

valuesP50 = appendValue(valuesP50, res.P50)
d.widgets.percentilesChart.Series("p50", valuesP50,
linechart.SeriesCellOpts(d.widgets.p50Legend.cellOpts...),
)
valuesP90 = appendValue(valuesP90, res.P90)
d.widgets.percentilesChart.Series("p90", valuesP90,
linechart.SeriesCellOpts(d.widgets.p90Legend.cellOpts...),
)
valuesP95 = appendValue(valuesP95, res.P95)
d.widgets.percentilesChart.Series("p95", valuesP95,
linechart.SeriesCellOpts(d.widgets.p95Legend.cellOpts...),
)
valuesP99 = appendValue(valuesP99, res.P99)
d.widgets.percentilesChart.Series("p99", valuesP99,
linechart.SeriesCellOpts(d.widgets.p99Legend.cellOpts...),
)

Support local address option

  • Make it possible to specify the local address used with the requests by passing --local-addr

Only tiny changes are required because all we have to do is just pass to the Vegeta API.

Disregard for outliers

Even one outlier makes it difficult to analyze the other parts. It would be nice to be able to ignore outliers by specifying a percentile.

Screenshot

PPA for Ubuntu-based systems

ali is published as a .deb package, but for long-term use, where one would like to get updates as part of system maintenance so that we easily have an up-to-date version.

We need to look into how to do automatic updates during general usage, e.g. in CI.

Panic when reading StatusCodes map while infinite attack

While the likelihood of occurrence has decreased by merging #77, panic still occurs.

Give as:

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

Then:

goroutine 37 [running]:                                                    ││                                                                          ││                                                                          │└───────────────────────────────────────────────────────────────────────────┘│                                                                            │
runtime.throw(0x1410c0a, 0x26)                                             ││                                                                          ││                                                                          │┌Errors─────────────────────────────────────────────────────────────────────┐│                                                                            │
│       /opt/hostedtoolcache/go/1.15.3/x64/src/runtime/panic.go:1116 +0x72 fp=0xc015c03b40 sp=0xc015c03b10 pc=0x1034b32                                ││                                                                          ││- Get "http://34.84.111.163:9898": dial tcp 0.0.0.0:0->34.84.111.163:9898: ││                                                                            │
runtime.mapiternext(0xc015c03d40)                                          ││                                                                          ││                                                                          ││socket: too many open files                                                ││                                                                            │
│       /opt/hostedtoolcache/go/1.15.3/x64/src/runtime/map.go:853 +0x554 fp=0xc015c03bc0 sp=0xc015c03b40 pc=0x1010814                                  ││                                                                          ││                                                                           ││                                                                            │
github.com/nakabonne/ali/gui.(*drawer).redrawMetrics(0xc0000b80d0, 0x1476c20, 0xc00009e080)                                                            ││                                                                          ││                                                                           ││                                                                            │
│       /home/runner/work/ali/ali/gui/drawer.go:218 +0x193 fp=0xc015c03fc8 sp=0xc015c03bc0 pc=0x1347373                                                ││                                                                          ││                                                                           ││                                                                            │
runtime.goexit()                                                           ││                                                                          ││                                                                          ││                                                                           ││                                                                            │
│       /opt/hostedtoolcache/go/1.15.3/x64/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc015c03fd0 sp=0xc015c03fc8 pc=0x1068fe1                              ││                                                                          ││                                                                           ││                                                                            │
created by github.com/nakabonne/ali/gui.run                                ││                                                                          ││                                                                          ││                                                                           ││                                                                            │
│       /home/runner/work/ali/ali/gui/gui.go:78 +0x63c

For some reason, there is panic here:

for code, n := range m.StatusCodes {

Support more options for HTTP requests

  • int workers
  • int maxWorkers
  • int connections
  • int maxConnections
  • int maxBody
  • string localAddr
  • string unixSocket
  • string proxyHeader
  • bool chunkedBody
  • bool keepAlive
  • bool HTTP2
  • bool H2C

Support HTTP2 option

  • Make it possible to switch to send HTTP/2 requests when supported by the server

Only tiny changes are required because all we have to do is just pass to the Vegeta API.

Error when duration is set to 0s

If I run

➜  ~ ali --duration=0s https://google.com
duration must be greater than 0

I get that duration must be greater than 0. But in the help text it says:

  -d, --duration duration   The amount of time to issue requests to the targets. Give 0s for an infinite attack. (default 10s)

Is infinite attack supported or not?

Support workers options

  • Enable to specify the initial number of workers by giving -wor --workers
  • Enable to specify the maximum number of workers by giving -Wor --max-workers

Only tiny changes are required because all we have to do is just pass to the Vegeta API.

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.