Sunday, March 31, 2013

httperf performance script

Here's a script that relies on httperf and runs in a loop for generation of HTTP traffic. It relies on Httperf

It provides time measurement for completion of the request and overall is an excellent tool for  http webserver benchmarking

---------------------------------------------------    SOM       ----------------------------------------

proteus:downloads kfelix$ cat httperf_requester.sh


#!/bin/bash
#
#

#rev 1.0

#  HTTP requester for traffic generation via httperf
#  full http.request == GET|PUT|POST|HEAD|TRACE etc......

#  Be careful not to flood any downwind DoS monitors, and be kind to your client sever(s)!
#
#
if [ ! $1 ]; then
            echo " Usage : httperf_requester.sh <delay in seconds between requests>  < The total #s of requests to send > <server ip_addrss in x.x.x.x>   <url>   <http.request METHOD 'GET|HEAD|PUT|POST|TRACE' > "
            echo ""
            echo "Example  httperf_requester.sh 5 10  192.0.2.1 http://www.5example.com GET"

            echo ""

            echo "  or   "

            echo "Example  httperf_requester.sh 5 10  192.0.2.1 http://www.5example.com HEAD"
            echo ""

            exit 1
fi

#
i="0"

#
MAX=1000

COUNTER=$2

H=httperf

if  (( $2 >= $MAX )) ; then

        echo "   "
        echo "Please make a request range of <1000 or less"
        echo "   "
else


while [ $i -lt $COUNTER ] ;

  do  $H --server $3 --num-conn 1 --uri $4 --timeout 60 --max-connections 1 --method $5 | grep "Total:"

  sleep $1

  echo "The request connection times are given above"
  echo ""

  i=$[$i + 1]

#   let "COUNTER += 1"

done
fi

---------------------------------------------------    EOM       ----------------------------------------

Ken Felix
Freelance Network/Security Engineer
kfelix  a-t hyperfeed d-o-t com

No comments:

Post a Comment