Skip to content

Instantly share code, notes, and snippets.

@nwiizo
Created April 11, 2019 02:24
Show Gist options
  • Select an option

  • Save nwiizo/103ab8eb44fa8fa2e3cb1680930210aa to your computer and use it in GitHub Desktop.

Select an option

Save nwiizo/103ab8eb44fa8fa2e3cb1680930210aa to your computer and use it in GitHub Desktop.
#!/bin/bash
flock -x /tmp/ab/wing ab -n 100 -c 5 http://localhost:8080/ > /tmp/ab/wing.txt
flock -x /tmp/ab/vps ab -n 100 -c 5 http://localhost:8888/ > /tmp/ab/vps.txt
wing_time=`cat /tmp/ab/wing.txt | grep "Time per request" |grep all | awk '{print $4;}'`
vps_time=`cat /tmp/ab/vps.txt | grep "Time per request" |grep all | awk '{print $4;}'`
wing_longest_request=`cat /tmp/ab/wing.txt | grep "longest request" | awk '{print $2}'`
vps_longest_request=`cat /tmp/ab/vps.txt | grep "longest request" | awk '{print $2}'`
echo ${wing_time}
echo ${vps_time}
curl_wing="curl -i -XPOST 'http://localhost:8086/write?db=statsdemo' --data-binary 'time_per_request,host=wing value=${wing_time}'"
curl_vps="curl -i -XPOST 'http://localhost:8086/write?db=statsdemo' --data-binary 'time_per_request,host=vps value=${vps_time}'"
curl_request_wing="curl -i -XPOST 'http://localhost:8086/write?db=statsdemo' --data-binary 'longest_request,host=wing value=${wing_longest_request}'"
curl_request_vps="curl -i -XPOST 'http://localhost:8086/write?db=statsdemo' --data-binary 'longest_request,host=vps value=${vps_longest_request}'"
eval ${curl_wing}
eval ${curl_vps}
eval ${curl_request_wing}
eval ${curl_request_vps}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment