X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fresources%2Fadvanced%2Fburst.sh;fp=example%2Fdiameter%2Flauncher%2Fresources%2Fadvanced%2Fburst.sh;h=0000000000000000000000000000000000000000;hb=7bf36f6cec41494071f07699184d8230ccd8cb41;hp=b05b6e076f8ae9e0aefe8fb119281cc8b4e877e8;hpb=08bdffbddf4bc0938eadec51af88de18734beda3;p=anna.git diff --git a/example/diameter/launcher/resources/advanced/burst.sh b/example/diameter/launcher/resources/advanced/burst.sh deleted file mode 100755 index b05b6e0..0000000 --- a/example/diameter/launcher/resources/advanced/burst.sh +++ /dev/null @@ -1,184 +0,0 @@ -#!/bin/bash -> curl_log.txt -TRACE="--trace-ascii curl_log.txt" -SERVER=`cat .httpServer` -burstMargin__dflt=1 - -salir () { - echo - echo $1 - echo - exit -} - -calc () { echo "$1" | bc -l ; } - -entero () { - limpio=$(calc "scale=0;${1}/1") - [[ $limpio != $1 ]] && salir "Invalid value '$1'. Must be integer" -} - -uso () { - - echo "Load tests configuration script" - echo - echo "Use: $0 [action parameters]" - echo - echo " clear:" - echo " Clears all loaded burst messages." - echo - echo " load :" - echo " Loads 'amount' messages for the provided traffic type. For example:" - echo " $0 load 2000 sms" - echo - echo " start [initial launch: default $burstMargin__dflt]:" - echo " Starts the message sending from the begining of the burst list loaded," - echo " with a certain initial load. For example:" - echo " $0 start 200" - echo - echo " push [amount: default $burstMargin__dflt]:" - echo " Launch 'amount' messages as initial load does (non-asynchronous mode)." - echo " It works even if burst launch is stopped. Useful to achieve congestion" - echo " conditions. For example:" - echo " $0 push 300" - echo - echo " pop [amount: default $burstMargin__dflt]:" - echo " Skip send burst messages in order to reduce over-the-air requests." - echo - echo " stop:" - echo " Stops the burst cycle at the current position. It could affect sessions" - echo " on the air (i.e. data contexts). Totally safe for IEC scenaries as SMS." - echo - echo " resume:" - echo " Resume an stopped burst launch from the same point (start will reset" - echo " the work pointer to the first burst list position). This is equivalent" - echo " to one-message-push operation." - echo - echo " repeat [[yes] | no]:" - echo " Restarts the burst launch cycle when finished." - echo - echo " send [amount: default 1]:" - echo " send messages from burst list. The main difference with start/push operations" - echo " is that burst won't be awaken. Externally we could control sending time (no" - echo " request will be sent for answers). When reach the last position, starts again." - echo - echo " sendXS [amount: default -1 (no limit)]:" - echo " send messages from burst list with the TPS provided. User could hot change" - echo " speed by mean 'echo > .tps' at another shell. You can stop the load" - echo " removing that hidden file or using CTRL+C from the shell where you launched" - echo " the burst command. Real tps is dumped on '.real_tps' file during testing." - echo " You could limit the amount of messages sent by mean the second parameter." - echo " No limit is established by default (-1 or negative value)." - echo - echo " goto :" - echo " Updates current burst pointer position." - echo - echo " look :" - echo " Show programmed burst message for order provided." - echo - echo - salir -} - -_curl () { - curl -m 5 --data "$1" $TRACE ${SERVER} -} - -echo -echo -[[ "$1" = "" ]] && uso -case $1 in - clear) _curl "burst|clear" - ;; - load) [[ "$3" = "" ]] && uso - [[ ! -f "${3}.sh" ]] && salir "Burst generation file '${3}.sh' not found!" - entero $2 - if test "$3" = "data" - then - count=$2 - RESTO=$((count%4)) - [[ "$RESTO" != "0" ]] && salir "Data context should load a multiple of 4 (messages generated by data.sh)" - fi - count=1 - while test "$count" -le "$2" - do - ${3}.sh $count > .${3}.xml - echo -n "Loading message ${count}; " - _curl "burst|load|.${3}.xml" - count=$((count+1)) - done - ;; - start) load=$burstMargin__dflt - [[ "$2" != "" ]] && load=$2 - entero $load - _curl "burst|start|$load" - ;; - pop) release=$burstMargin__dflt - [[ "$2" != "" ]] && release=$2 - entero $release - _curl "burst|pop|$release" - ;; - push) [[ "$2" = "" ]] && uso - entero $2 - _curl "burst|push|$2" - ;; - stop) _curl "burst|stop" - ;; - resume) _curl "burst|push|1" - ;; - repeat) repeat=yes - [[ "$2" != "" ]] && repeat=$2 - _curl "burst|repeat|$repeat" - ;; - send) amount=1 - [[ "$2" != "" ]] && amount=$2 - entero $amount - _curl "burst|send|$amount" - ;; - sendXS) [[ "$2" = "" ]] && uso - limit=$3 - [[ "$limit" = "" ]] && limit=-1 - entero $2 - entero $limit - TPS=0 - count=0 - amount=1 - echo $2 > .tps - while test -f .tps - do - [[ "$count" = "$limit" ]] && break - BEFORE_ns=`date +%s%N` - READ_TPS=`cat .tps` - # Hot change could make .tps still unavailable: - [[ "$READ_TPS" = "" ]] && READ_TPS=$TPS - # Volvemos a calcular medias (REAL_TPS) cada 10 segundos o cuando cambia el TPS en caliente: - [[ "$READ_TPS" != "$TPS" ]] && { BEGIN_ns=$BEFORE_ns ; count=0 ; } - [[ $count = $((10*TPS)) ]] && { BEGIN_ns=$BEFORE_ns ; count=0 ; } - TPS=$READ_TPS - [[ "$TPS" = "0" ]] && salir "Test stopped due to 0-tps value read" - # Background: - _curl "burst|send|$amount" & - count=$((count+amount)) - AFTER_ns=`date +%s%N` - # Real tps: - REAL_TPS=$(calc "1000000000 * $count / ($AFTER_ns - $BEGIN_ns)") - echo $REAL_TPS > .real_tps - - COEF=1 - [[ $(calc "$TPS > $REAL_TPS") = "1" ]] && COEF=$(calc "$REAL_TPS / $TPS") - K=$(calc "$COEF ^ 10") - amount=$(calc "scale=0;1/$K") - usleep $(calc "$K * 1000000/$TPS") - done - ;; - goto) [[ "$2" = "" ]] && uso - entero $2 - _curl "burst|goto|$2" - ;; - look) [[ "$2" = "" ]] && uso - entero $2 - _curl "burst|look|$2" - ;; - *) uso -esac -