caching-approaches-comparison

1,10,50 users. generate workloads on uncached. reduced execution

6/1/2019 2:47:07 AM

Changes

.gitignore 4(+3 -1)

configure 8(+4 -4)

reduce.sh 34(+17 -17)

run.sh 60(+44 -16)

server.sh 2(+1 -1)

trace.sh 8(+5 -3)

Details

.gitignore 4(+3 -1)

diff --git a/.gitignore b/.gitignore
index f4a3981..8540b4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
 /adapters
 /approaches
-/applications
\ No newline at end of file
+/applications
+/docker
+/analysis

configure 8(+4 -4)

diff --git a/configure b/configure
index a504c83..4815c82 100755
--- a/configure
+++ b/configure
@@ -5,19 +5,19 @@ if [ -z $1 ]; then
 
 	apt-get -qq -y install software-properties-common
 
-	add-apt-repository ppa:webupd8team/java -y
+	add-apt-repository ppa:linuxuprising/java -y
 
 	apt-get update -qq
 
 	echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
 	echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
-	apt-get -qq -y install oracle-java8-installer
+	echo debconf shared/accepted-oracle-license-v1-2 select true | debconf-set-selections
+	echo debconf shared/accepted-oracle-license-v1-2 seen true | debconf-set-selections
+	apt-get -qq -y install oracle-java12-installer
 	apt-get -qq -y install maven
 	apt-get -qq -y install git
 	apt-get -qq -y install netcat
 
-	export JAVA_HOME=/usr/lib/jvm/java-8-oracle
-
 	apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
 	curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
 	add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

reduce.sh 34(+17 -17)

diff --git a/reduce.sh b/reduce.sh
index 32840cc..cd0e5e9 100644
--- a/reduce.sh
+++ b/reduce.sh
@@ -21,26 +21,26 @@ if [[ ! -z $1 ]]; then
 fi
 
 echo "Reducing in host $host for the applications $applications among the versions $versions"
-for workload in {1..10}; do
-	for user in 1 5 10 25 50; do
-		for version in $versions; do
-			version=${version%/}
-			if [[ $applications = "*" ]]; then
-				existing_applications=$(echo applications/cached/$version/*/)
-			else
-				existing_applications=$applications
-			fi
-			echo "Reducing applications $existing_applications with $user users and workload $workload"
-			for application in $existing_applications; do
-				application=${application%/}
-				echo "Reducing $application with $user users and workload $workload"
-				java -jar adapters/RequestsSimulator/target/RequestsSimulator-1.0.jar --throughput=applications/output/$application-$version-${user}user-${workload}workload-requests --reduce=applications/output/requests-handled.csv --prefix=$application,$version,$user,$workload,
+for version in $versions; do
+	version=${version%/}
+	if [[ $applications = "*" ]]; then
+		existing_applications=$(echo applications/cached/$version/*/)
+	else
+		existing_applications=$applications
+	fi
+	for application in $existing_applications; do
+		application=${application%/}
+		for user in 1 10 50; do
+			for execution in {1..10}; do
+				echo "Reducing $application-$version with $user users and execution $execution"
+				java -jar adapters/RequestsSimulator/target/RequestsSimulator-1.0.jar --throughput=applications/output/$application-$version-${user}user-${execution}execution-requests --reduce=applications/output/requests-handled.csv --prefix=$application,$version,$user,$execution,
 				if [[ $host = "localhost" ]]; then
-					java -jar adapters/Cache/target/Cache-1.0.jar applications/output/$application-$version-${user}user-${workload}workload-cache applications/output/hits-additions-distribution.csv $application,$version,$user,$workload,
+					java -jar adapters/Cache/target/Cache-1.0.jar applications/output/$application-$version-${user}user-${execution}execution-cache applications/output/hits-distribution.csv $application,$version,$user,$execution,
 				else
-					echo "java -jar adapters/Cache/target/Cache-1.0.jar applications/output/$application-$version-${user}user-${workload}workload-cache applications/output/hits-additions-distribution.csv $application,$version,$user,$workload," | netcat -w0 $host 5000
+					while ! </dev/tcp/$host/5000; do sleep 5; done
+					echo "caching-approaches-comparison java -jar adapters/Cache/target/Cache-1.0.jar applications/output/$application-$version-${user}user-${execution}execution-cache applications/output/hits-distribution.csv $application,$version,$user,$execution," | netcat -w0 $host 5000
 				fi
 			done
 		done
 	done
-done
\ No newline at end of file
+done

run.sh 60(+44 -16)

diff --git a/run.sh b/run.sh
index 60a2a6a..95b81ce 100644
--- a/run.sh
+++ b/run.sh
@@ -20,9 +20,41 @@ if [[ ! -z $1 ]]; then
 	fi
 fi
 
-echo "Running in host $host for the applications $applications among the versions $versions"
-for workload in {1..10}; do
-	for user in 1 5 10 25 50; do
+echo "Checking workloads of the applications $applications"
+if [[ $applications = "*" ]]; then
+	existing_applications=$(echo applications/uncached/*/)
+else
+	existing_applications=$applications
+fi
+for application in $existing_applications; do
+	application=${application%/}
+	for user in 1 10 50; do
+		if [[ ! -f applications/workloads/$application-workload-${user}user.json ]]; then
+			echo "Generating workloads for $applications with $user users"
+			if [[ $host = "localhost" ]]; then
+				docker-compose -f applications/uncached/$application/docker-compose.yml up -d --build
+			else
+				while ! </dev/tcp/$host/5000; do sleep 5; done
+				echo "caching-approaches-comparison docker-compose -f applications/uncached/$application/docker-compose.yml up -d --build" | netcat -w0 $host 5000
+			fi
+			while ! curl -s $host:8080 > /dev/null; do sleep 5; done
+			java -jar adapters/RequestsSimulator/target/RequestsSimulator-1.0.jar --profile=applications/workloads/$application.json --time=1500000 --users=$user --log=applications/workloads/$application-workload-${user}user.json --throughput=applications/output/$application-workload-${user}user-requests --host=$host > applications/output/$application-workload-${user}user-simulator.log 2>&1
+			if [[ $host = "localhost" ]]; then
+				docker-compose -f applications/uncached/$application/docker-compose.yml down -v
+			else
+				while ! </dev/tcp/$host/5000; do sleep 5; done
+				echo "caching-approaches-comparison docker-compose -f applications/uncached/$application/docker-compose.yml down -v" | netcat -w0 $host 5000
+				sleep 11
+			fi
+		else
+			echo "Reusing workload for $application with $user users"
+		fi
+	done
+done
+
+echo "Executing workloads in host $host for the applications $applications among the versions $versions"
+for execution in {1..10}; do
+	for user in 1 10 50; do
 		for version in $versions; do
 			version=${version%/}
 			if [[ $applications = "*" ]]; then
@@ -30,32 +62,28 @@ for workload in {1..10}; do
 			else
 				existing_applications=$applications
 			fi
-			echo "Running applications $existing_applications with $user users and workload $workload"
+			echo "Running $execution execution with $user users of applications $existing_applications"
 			for application in $existing_applications; do
 				application=${application%/}
-				echo "Running $application with $user users and workload $workload"
+				echo "Running $application with $user users and execution $execution"
 				if [[ $host = "localhost" ]]; then
-					export CACHE_EVENTS=/caching-approaches-comparison/applications/output/$application-$version-${user}user-${workload}workload-cache
+					export CACHE_EVENTS=/caching-approaches-comparison/applications/output/$application-$version-${user}user-${execution}execution-cache
 					docker-compose -f applications/cached/$version/$application/docker-compose.yml up -d --build
 				else
-					echo "caching-approaches-comparison export CACHE_EVENTS=/caching-approaches-comparison/applications/output/$application-$version-${user}user-${workload}workload-cache" | netcat -w0 $host 5000
+					while ! </dev/tcp/$host/5000; do sleep 5; done
+					echo "caching-approaches-comparison export CACHE_EVENTS=/caching-approaches-comparison/applications/output/$application-$version-${user}user-${execution}execution-cache" | netcat -w0 $host 5000
 					echo "caching-approaches-comparison docker-compose -f applications/cached/$version/$application/docker-compose.yml up -d --build" | netcat -w0 $host 5000
 				fi
-				bash -c 'while ! curl -s '$host:8080' > /dev/null; do sleep 5; done'
-				if [[ ! -f applications/workloads/$application-execution-${user}user-${workload}workload.json ]]; then
-					echo "Generating workload"
-					java -jar adapters/RequestsSimulator/target/RequestsSimulator-1.0.jar --profile=applications/workloads/$application.json --time=3600000 --users=$user --log=applications/workloads/$application-execution-${user}user-${workload}workload.json --throughput=applications/output/$application-$version-${user}user-${workload}workload-requests > applications/output/$application-$version-${user}user-${workload}workload-simulator.log 2>&1
-				else
-					echo "Repeating workload"
-					java -jar adapters/RequestsSimulator/target/RequestsSimulator-1.0.jar --profile=applications/workloads/$application.json --execute=applications/workloads/$application-execution-${user}user-${workload}workload.json --throughput=applications/output/$application-$version-${user}user-${workload}workload-requests > applications/output/$application-$version-${user}user-${workload}workload-simulator.log 2>&1
-				fi
+				while ! curl -s $host:8080 > /dev/null; do sleep 5; done
+				java -jar adapters/RequestsSimulator/target/RequestsSimulator-1.0.jar --profile=applications/workloads/$application.json --execute=applications/workloads/$application-workload-${user}user.json --throughput=applications/output/$application-$version-${user}user-${execution}execution-requests --host=$host > applications/output/$application-$version-${user}user-${execution}execution-simulator.log 2>&1
 				if [[ $host = "localhost" ]]; then
 					docker-compose -f applications/cached/$version/$application/docker-compose.yml down -v
 				else
+					while ! </dev/tcp/$host/5000; do sleep 5; done
 					echo "caching-approaches-comparison docker-compose -f applications/cached/$version/$application/docker-compose.yml down -v" | netcat -w0 $host 5000
 					sleep 11
 				fi
 			done
 		done
 	done
-done
\ No newline at end of file
+done

server.sh 2(+1 -1)

diff --git a/server.sh b/server.sh
index 2a147c2..40bcd1a 100644
--- a/server.sh
+++ b/server.sh
@@ -8,7 +8,7 @@ fi
 echo "Start listening on port 5000 ..."
 while read line
 do
-	if [ "$line" == 'exit' ]; then
+	if [ "$line" == 'caching-approaches-comparison exit' ]; then
 		echo "Received 'exit'"
 		break
 	else

trace.sh 8(+5 -3)

diff --git a/trace.sh b/trace.sh
index 5fe8bcf..8abf638 100644
--- a/trace.sh
+++ b/trace.sh
@@ -22,14 +22,16 @@ for application in $applications; do
 	if [[ $host = "localhost" ]]; then
 		docker-compose -f applications/uncached/$application/docker-compose.yml up -d --build
 	else
+		while ! </dev/tcp/$host/5000; do sleep 5; done
 		echo "caching-approaches-comparison docker-compose -f applications/uncached/$application/docker-compose.yml up -d --build" | netcat -w0 $host 5000
 	fi
-	bash -c 'while ! curl -s '$host:8080' > /dev/null; do sleep 5; done'
-	java -jar adapters/RequestsSimulator/target/RequestsSimulator-1.0.jar --profile=applications/workloads/$application.json --time=3600000 --users=1 --log=applications/workloads/$application-execution-uncached.json --throughput=applications/output/$application-uncached-requests > applications/output/$application-uncached-simulator.log 2>&1
+	while ! curl -s $host:8080 > /dev/null; do sleep 5; done
+	java -jar adapters/RequestsSimulator/target/RequestsSimulator-1.0.jar --profile=applications/workloads/$application.json --time=600000 --users=1 --log=applications/workloads/$application-execution-uncached.json --throughput=applications/output/$application-uncached-requests --host=$host > applications/output/$application-uncached-simulator.log 2>&1
 	if [[ $host = "localhost" ]]; then
 		docker-compose -f applications/uncached/$application/docker-compose.yml down -v
 	else
+		while ! </dev/tcp/$host/5000; do sleep 5; done
 		echo "caching-approaches-comparison docker-compose -f applications/uncached/$application/docker-compose.yml down -v" | netcat -w0 $host 5000
 		sleep 11
 	fi
-done
\ No newline at end of file
+done