diff distributed/weighttp/stress_weighttp.sh @ 19:c28f8d47c60d

Added
author Nobuyasu
date Wed, 29 Jan 2014 14:16:08 +0900
parents
children 61221984aa56
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/distributed/weighttp/stress_weighttp.sh	Wed Jan 29 14:16:08 2014 +0900
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+export LD_LIBRARY_PATH=/usr/local/lib 
+hostname=`hostname`
+clientsFile=$1
+nodesFile=$2
+schedule=$3
+requestNum=$4
+concurrent=$5
+threadNum=$6
+
+function get_node_name() {
+    num=$1
+    nodeLength=0    
+    nodeArray=()
+    while read serv
+    do
+     nodeArray[$nodeLength]=$serv
+     nodeLength=`expr $nodeLength + 1`
+    done
+    echo ${nodeArray[$num]}
+}
+
+function get_my_num() {
+    num=0
+    myName=$1
+    while read serv
+    do
+      if [ $serv = $myName ]; then
+	  break
+      fi
+      num=`expr $num + 1`
+    done
+    echo $num
+}
+
+myNum=`get_my_num < $clientsFile $hostname`
+nodeUrl=`get_node_name < $nodesFile $myNum`
+uri=":8080/editMessageUseGet?bname=hello%20world&uuid=0&author=oshiro&msg=write_test&key="
+
+now=$(date +%s)
+sleepTime=`expr $schedule - $now`
+sleep $sleepTime
+ret=`/home/mass/student/k128576/opt/bin/weighttp -n $requestNum -c $concurrent -t $threadNum -k $nodeUrl$uri`
+#ret=`/home/mass/student/k128576/opt/bin/weighttp -n 100000 -c 200 -t 2 -k $nodeUrl$uri`
+#echo $ret
+time=`echo $ret | awk '{print $62 " " $63 " " $82 " " $83}' `
+echo $time