X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=perf%2Fbash%2Fpar_fixed_clients.sh;h=a44158955b517aa79d97672ed2b1c573da023b09;hb=f4b58b73e53b5f3727530fed355ca7c7dc046c22;hp=7dc8779dd299a6de47c583559e5726c2ff900b25;hpb=1b15ac45e671e7bd1d211291c5db197604beca30;p=pazpar2-moved-to-github.git diff --git a/perf/bash/par_fixed_clients.sh b/perf/bash/par_fixed_clients.sh index 7dc8779..a441589 100755 --- a/perf/bash/par_fixed_clients.sh +++ b/perf/bash/par_fixed_clients.sh @@ -1,23 +1,41 @@ #!/bin/bash -DELAY=0.001 -WAIT=1 -NUMBER=100 -ROUNDS=5 +NUMBER=$1 +if [ -z "$NUMBER" ] ; then + NUMBER=20 +fi + +MAX_DELAY=1 +CLIENT_WAIT=2 +ROUNDS=10 let r=0 +PORT=$2 +SERVICE=$3 +CLIENT_SCRIPT="client_timed.sh" +rm -f *.time +if [ "$TMP_DIR" == "" ] ; then + export TMP_DIR=run_`date +"%Y%m%d_%H%M%S"`/ +fi +mkdir -p ${TMP_DIR} +rm -f latest +ln -s ${TMP_DIR} latest while test $r -lt $ROUNDS; do - echo "$r" - i=0 - while test $i -lt $NUMBER; do - ./client.sh $r.$i >$r.$i.log 2>&1 & - CLIENTS=`ps -ef |grep -c client.sh` - while test $CLIENTS -ge $NUMBER ; do - sleep $WAIT - CLIENTS=`ps -ef |grep -c client.sh` - echo "Active $CLIENTS" - done - let i=$i+1 + echo "$r" + i=0 + while test $i -lt $NUMBER; do + ./${CLIENT_SCRIPT} $r.$i $PORT $SERVICE >$r.$i.log 2>&1 & + SLEEP=$[ ( $RANDOM % $MAX_DELAY ) ] + sleep $SLEEP + CLIENTS=`ps -ef |grep ${CLIENT_SCRIPT} | grep -cv grep` + while test $CLIENTS -ge $NUMBER ; do + sleep $CLIENT_WAIT + CLIENTS=`ps -ef |grep ${CLIENT_SCRIPT} |grep -cv grep ` + echo "Active $CLIENTS" done - let r=$r+1 + let i=$i+1 + done + let r=$r+1 done wait -wget -O x 'http://localhost:8010/?command=exit' +cat ${TMP_DIR}*.time >> ${TMP_DIR}timed.$SERVICE.$NUMBER.log +#wget --tries=1 -O x "http://localhost:${PORT}/?command=exit" +