vegeta icon indicating copy to clipboard operation
vegeta copied to clipboard

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

Open hjacobs opened this issue 7 years ago • 9 comments

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 avatar Jul 01 '18 07:07 hjacobs

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"

hjacobs avatar Jul 01 '18 07:07 hjacobs

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

tsenart avatar Jul 01 '18 09:07 tsenart

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

hjacobs avatar Jul 01 '18 10:07 hjacobs

I mean't a GIF or similar.

tsenart avatar Jul 01 '18 14:07 tsenart

@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 avatar Jul 01 '18 15:07 hjacobs

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

hjacobs avatar Jul 01 '18 16:07 hjacobs

Alright, PR welcome!

tsenart avatar Jul 02 '18 13:07 tsenart

Did this go anywhere?

sandbardev avatar Mar 22 '21 19:03 sandbardev

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 🙂

thylong avatar May 13 '21 13:05 thylong