Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to add recycled container count to the output #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions test/ex3.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
./repeattest.sh 10
echo "[ex3.sh] Calling repeattest with api gateway url = " $1
#./partest.sh 100 100 2 2 | tail -n 1 >> .myruns
#sleep 10

./repeattest.sh 10 $1
echo "10 second sleep"
echo "-----------------------------------------------------------------------------------------------------------------------------"
./repeattest.sh 60
exit
echo
"-----------------------------------------------------------------------------------------------------------------------------"

./repeattest.sh 60 $1
echo "60 second sleep"
echo "-----------------------------------------------------------------------------------------------------------------------------"
./repeattest.sh 300
./repeattest.sh 300 $1
echo "5 min sleep"
echo "-----------------------------------------------------------------------------------------------------------------------------"
./repeattest.sh 600
exit
./repeattest.sh 600 $1
echo "10 min sleep"
echo "-----------------------------------------------------------------------------------------------------------------------------"
./repeattest.sh 900
./repeattest.sh 900 $1
echo "15 min sleep"
echo "-----------------------------------------------------------------------------------------------------------------------------"
./repeattest.sh 1200
./repeattest.sh 1200 $1
echo "20 min sleep"
echo "-----------------------------------------------------------------------------------------------------------------------------"
./repeattest.sh 1500
./repeattest.sh 1500 $1
echo "25 min sleep"
echo "-----------------------------------------------------------------------------------------------------------------------------"
./repeattest.sh 1800
./repeattest.sh 1800 $1
echo "30 min sleep"
echo "-----------------------------------------------------------------------------------------------------------------------------"
./repeattest.sh 2100
./repeattest.sh 2100 $1
echo "35 min sleep"
echo "-----------------------------------------------------------------------------------------------------------------------------"
./repeattest.sh 2400
./repeattest.sh 2400 $1
echo "40 min sleep"
echo "-----------------------------------------------------------------------------------------------------------------------------"
./repeattest.sh 2700
./repeattest.sh 2700 $1
echo "45 min sleep"
echo "-----------------------------------------------------------------------------------------------------------------------------"
./repeattest.sh 3000
echo "50 min sleep"
#./repeattest.sh 3000
echo "-----------------------------------------------------------------------------------------------------------------------------"

68 changes: 58 additions & 10 deletions test/partest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ callservice() {
#json={"\"name\"":"\"\",\"calcs\"":1000,\"sleep\"":0,\"loops\"":20}

#(3) - medium calcs 200,000
#json={"\"name\"":"\"\",\"calcs\"":10000,\"sleep\"":0,\"loops\"":20}
json={"\"name\"":"\"\",\"calcs\"":10000,\"sleep\"":0,\"loops\"":20}

#(4) - somewhat heavy calcs - 500,000
json={"\"name\"":"\"\",\"calcs\"":25000,\"sleep\"":0,\"loops\"":20}
#json={"\"name\"":"\"\",\"calcs\"":25000,\"sleep\"":0,\"loops\"":20}

#(5) - heavy calcs - 2,000,000
#json={"\"name\"":"\"\",\"calcs\"":100000,\"sleep\"":0,\"loops\"":20}
Expand All @@ -62,7 +62,7 @@ callservice() {
#uuid=`curl -H "Content-Type: application/json" -X POST -d "{\"name\": \"Fred\"}" https://ue5e0irnce.execute-api.us-east-1.amazonaws.com/test/test 2>/dev/null | cut -d':' -f 3 | cut -d'"' -f 2`
####output=`curl -H "Content-Type: application/json" -X POST -d $json https://a9gseqxep9.execute-api.us-east-1.amazonaws.com/test2/test 2>/dev/null`
###output=`curl -H "Content-Type: application/json" -X POST -d $json https://ctbiwxx3f3.execute-api.us-east-1.amazonaws.com/dev1 2>/dev/null`
output=`curl -H "Content-Type: application/json" -X POST -d $json https://ue5e0irnce.execute-api.us-east-1.amazonaws.com/test/test 2>/dev/null`
output=`curl -H "Content-Type: application/json" -X POST -d $json $apigateway 2>/dev/null`
#output=`curl -H "Content-Type: application/json" -X POST -d $json https://b3euo2n6s7.execute-api.us-east-1.amazonaws.com/test 2>/dev/null`
########################output=`curl -H "Content-Type: application/json" -X POST -d $json https://i1dc63pzgh.execute-api.us-east-1.amazonaws.com/test5/ 2>/dev/null`
#output=`curl -H "Content-Type: application/json" -X POST -d $json https://ue5e0irnce.execute-api.us-east-1.amazonaws.com/test/test 2>/dev/null | cut -d':' -f 3 | cut -d'"' -f 2`
Expand Down Expand Up @@ -136,6 +136,11 @@ recyvms=0
# Generate CSV output - group by container
# Reports unique number of containers used or created
#########################################################################################################################################################
if [[ ! -z $contreport && $contreport -eq 1 ]]
then
rm -f .origcont
fi

filename=".uniqcont"
while read -r line
do
Expand All @@ -148,19 +153,28 @@ do
# if uuid is already in array
found=0
(( newconts += isnewcont))


##
## Process the contreport flag, to generate or compare against the .origcont file
##
## if state = 1 initialize file
# if [[ ! -z $contreport && $contreport -eq 1 ]]
# then
# echo "$uuid" >> .origcont
# fi




for ((i=0;i < ${#containers[@]};i++)) {
if [ "${containers[$i]}" == "${uuid}" ]; then
(( cuses[$i]++ ))
ctimes[$i]=`expr ${ctimes[$i]} + $time`
found=1
fi

##
## Process the vmreport flag, to generate or compare against the .origcont file
##
## if state = 1 initialize file

## if state = 2 compare against file to obtain total count of recycled containers used

}

## so this is where we need to process the
Expand Down Expand Up @@ -193,6 +207,40 @@ do
# containers+=($uuid)
#fi
done < "$filename"

echo "ARRAY SIZE EQUAL ${#containers[@]} "
if [[ ! -z $contreport && $contreport -eq 1 ]]
then
for ((i=0;i < ${#containers[@]};i++)) {
echo "${containers[$i]}" >> .origcont
}
fi

## if state = 2 compare against file to obtain total count of recycled containers used
if [[ ! -z $contreport && $contreport -eq 2 ]]
then
for ((i=0;i < ${#containers[@]};i++)) {
# read the file and compare current containers to old containers in .origcont
# increment a counter every time we find a recycled container
# to calculate newcontainer, containers - recycledcontainers
filename=".origcont"
while read -r line
do
if [ "${containers[$i]}" == "${line}" ]
then
(( recycont ++ ))
break;
fi
done < "$filename"
}
fi







#echo "Containers=${#containers[@]}"
runspercont=`echo $totalruns / ${#containers[@]} | bc -l`
runsperhost=`echo $totalruns / ${#hosts[@]} | bc -l`
Expand Down Expand Up @@ -228,7 +276,7 @@ echo "host,host_up_time,uses,containers,totaltime,avgruntime_host,uses_minus_avg
total=0
if [[ ! -z $vmreport && $vmreport -eq 1 ]]
then
rm .origvm
rm -f .origvm
fi
for ((i=0;i < ${#hosts[@]};i++)) {
avg=`echo ${htimes[$i]} / ${huses[$i]} | bc -l`
Expand Down
10 changes: 7 additions & 3 deletions test/repeattest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ totalruns=1

# time to sleep in seconds between runs
sleep=$1
# API Gateway endpoint
apigateway=$2

echo "[repeatest.sh] Using API Gateway: " $apigateway " & Sleep time: " $sleep

for (( i=1 ; i <= $totalruns; i++ ))
do
echo "Run #$i-----------------------------------------------------------------------------"
./partest.sh 100 100
./partest.sh 100 100 2 2 $apigateway | tail -n 1 >> .myruns
echo -n "sleeping for $sleep seconds - press ctrl-C to exit"
for (( j=1 ; j <= $sleep; j++ ))
do
#sleep 1
echo -n "."
sleep 1
#echo -n "."
done
echo ""
done
Expand Down
15 changes: 15 additions & 0 deletions test/simulations-ex3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# total runs to perform
#rm -f .myruns
totalEx3Runs=5

# API Gateway endpoint
apigateway=$1

echo "[simulations-ex3.sh] Running ex3.sh using API Gateway: " $apigateway

for (( i=1 ; i <= $totalEx3Runs; i++ ))
do
echo "[simulations-ex3.sh] Run #$i for ex3.sh -----------------------------------------------------------------------"
./ex3.sh $apigateway
done