tsenart / vegeta

HTTP load testing tool and library. It's over 9000!
http://godoc.org/github.com/tsenart/vegeta/lib
MIT License
23.51k stars 1.36k forks source link

Real-time plot of requests for Linux (and other) terminals #301

Closed hjacobs closed 1 year ago

hjacobs commented 6 years ago

Proposal

I would like to have real-time plotting (aka chart, graph, ..) for request latencies on a Linux terminal. The README already includes an example for iTerm (MacOS), but none for other OS. I propose adding instructions on how to have real-time analysis on Linux, e.g. by using feedgnuplot.

Background

I'm currently testing my Connexion Example REST service with Kubernetes and want to test its behavior (including rolling updates and failures) under load.

Workarounds

I'm currently trying vegeta dump -dumper=csv and feedgnuplot. This seems to work. I would make a PR to include instructions on how to use it.

hjacobs commented 6 years ago

My current approach looks like:

echo "GET http://localhost:8080/pets" | vegeta attack | vegeta dump -dumper csv | awk -F, '{ printf "%f %.2f %d\n", $1/(1000**3),$3/(1000**2),$2}' | feedgnuplot --stream --domain --lines --exit --y2 1 --title "Request Latencies" --timefmt "%s" --y2min 0 --y2max 600 --ylabel "Latency [ms]" --y2label "HTTP Status Code"
tsenart commented 6 years ago

Cool! Can you make a screen capture and post it here? I'd love to see it in action.

hjacobs commented 6 years ago

My current command with "dumb" (ugly) terminal output:

echo "GET $url/pets" | vegeta attack -rate 8 | vegeta dump -dumper csv | awk -F, '{ printf "%f %.2f %d\nreplot\n", $1/(1000**3),$3/(1000**2),$2; fflush()}' | feedgnuplot --stream trigger --domain --lines --exit --y2 1 --title "Request Latencies" --timefmt "%s" --y2min 0 --y2max 600 --ylabel "Latency [ms]" --y2label "HTTP Status Code"  --terminal "dumb 270 62" --monotonic 2>/dev/null
tsenart commented 6 years ago

I mean't a GIF or similar.

hjacobs commented 6 years ago

@tsenart sure, I already had the video, but was busy on a conference (PyConWeb), so here finally the uploaded MP4 (could not make the conversation to GIF work): https://drive.google.com/open?id=1StqY0ZO66yyqejkNhCXqJsqZsJNUNcLx

hjacobs commented 6 years ago

Here the generated (scaled) GIF for the gnuplot X11 output (separate window, not directly in terminal). This looks much better but has the drawback of another window opening: out

The command was:

echo "GET $url/pets" | vegeta attack -rate 8 | vegeta dump -dumper csv | awk -F, '{ printf "%f %.2f %d\nreplot\n", $1/(1000**3),$3/(1000**2),$2; fflush()}' | feedgnuplot --stream trigger --domain --lines --exit --y2 1 --title "Request Latencies" --timefmt "%s" --y2min 0 --y2max 600 --ylabel "Latency [ms]" --y2label "HTTP Status Code"   --monotonic 2>/dev/null
tsenart commented 6 years ago

Alright, PR welcome!

sandbardev commented 3 years ago

Did this go anywhere?

thylong commented 3 years ago

Hey @sandobits , I don't know if this is still relevant to you but since the deprecation of vegeta dump in favor of vegeta encode & the addition of the plot subcommand, you can achieve a comparable result with only vegeta command:

echo "GET $url/pets" | vegeta attack -rate 8 -name=8qps | > results.8qps.bin && cat results.8qps.bin | vegeta plot > plot.8qps.html && open plot.8qps.html.

Leaving this here as it might be useful for oneliner lovers that happen to see this issue 🙂