tfcache-comparison
Details
functions.sh 11(+11 -0)
diff --git a/functions.sh b/functions.sh
new file mode 100644
index 0000000..a60c7c2
--- /dev/null
+++ b/functions.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+function execute() {
+ host="$1"
+ command="$2"
+ if [[ $host = "localhost" ]]; then
+ eval $command
+ else
+ while ! java -jar adapters/RemoteExecutor/target/RemoteExecutor-1.0.jar --send="caching-approaches-comparison $command" --host=$host --port=5000; do sleep 5; done
+ fi
+}
reduce.sh 18(+7 -11)
diff --git a/reduce.sh b/reduce.sh
index be1d888..da25309 100644
--- a/reduce.sh
+++ b/reduce.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+source functions.sh
+
if [ "$(whoami)" != 'root' ]; then
echo "You have no permission to run $0 as non-root user."
exit 1;
@@ -31,25 +33,19 @@ for version in $versions; do
if [[ ! -f applications/output/requests-handled.csv ]]; then
echo 'application,version,users,execution,time,requests' > applications/output/requests-handled.csv
if [[ $host = "localhost" ]]; then
- echo 'application,version,users,execution,name,identifier,event,amount' > applications/output/hits-distribution.csv
- else
- command="echo 'application,version,users,execution,name,identifier,event,amount' > applications/output/hits-distribution.csv"
- while ! java -jar adapters/RemoteExecutor/target/RemoteExecutor-1.0.jar --send="caching-approaches-comparison $command" --host=$host --port=5000; do sleep 5; done
+ echo 'application,version,users,name,identifier,event,amount' > applications/output/hits-distribution.csv
fi
fi
for application in $existing_applications; do
application=${application%/}
for user in 1 5 25; do
for execution in {1..10}; do
- echo "$(date '+%F %T') Reducing $application-$version with $user users and execution $execution"
+ echo "$(date '+%F %T') Reducing requests of $application-$version with $user users and execution $execution"
java $JAVA_OPTS -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 $JAVA_OPTS -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
- command="java $JAVA_OPTS -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,"
- while ! java -jar adapters/RemoteExecutor/target/RemoteExecutor-1.0.jar --send="caching-approaches-comparison $command" --host=$host --port=5000; do sleep 5; done
- fi
done
+ echo "$(date '+%F %T') Reducing cachemetrics of $application-$version with $user users"
+ command="java $JAVA_OPTS -jar adapters/Cache/target/Cache-1.0.jar applications/output/$application-$version-${user}user-cache applications/output/hits-distribution.csv $application,$version,$user,"
+ execute "$host" "$command"
done
done
done
run.sh 65(+31 -34)
diff --git a/run.sh b/run.sh
index f1e0eb1..7070b3f 100644
--- a/run.sh
+++ b/run.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+source functions.sh
+
if [ "$(whoami)" != 'root' ]; then
echo "You have no permission to run $0 as non-root user."
exit 1;
@@ -25,52 +27,47 @@ echo "$(date '+%F %T') Executing workloads in host $host for the applications $a
for application in $applications; do
application=${application%/}
for user in 25 5 1; do
+ if [[ ! -f applications/workloads/$application-workload-${user}user.json ]]; then
+ echo "$(date '+%F %T') Generating workload for $application with $user users"
+ command="JAVA_OPTS=$JAVA_SERVER_OPTS TRACER_ENABLE=false docker-compose -f applications/uncached/$application/docker-compose.yml up -d --build"
+ execute "$host" "$command"
+ while ! curl -s $host:8080 > /dev/null; do sleep 5; done
+ java $JAVA_OPTS -jar adapters/RequestsSimulator/target/RequestsSimulator-1.0.jar --profile=applications/workloads/$application.json --time=600000 --users=$user --log=applications/workloads/$application-workload-${user}user.json --throughput=applications/output/$application-workload-${user}user-requests --host=$host --home="applications/workloads/" > applications/output/$application-workload-${user}user-simulator.log 2>&1
+ command="docker-compose -f applications/uncached/$application/docker-compose.yml down -v"
+ execute "$host" "$command"
+ sleep 30
+ fi
for version in $versions; do
version=${version%/}
echo "$(date '+%F %T') Sampling $application with $user users in $version version"
for execution in {1..10}; do
- if [[ ! -f applications/workloads/$application-workload-${user}user.json ]]; then
- echo "$(date '+%F %T') Generating workload for $application with $user users"
- if [[ $host = "localhost" ]]; then
- export TRACER_ENABLE=false
- docker-compose -f applications/uncached/$application/docker-compose.yml up -d --build
- else
- command="JAVA_OPTS=$JAVA_SERVER_OPTS TRACER_ENABLE=false docker-compose -f applications/uncached/$application/docker-compose.yml up -d --build"
- while ! java -jar adapters/RemoteExecutor/target/RemoteExecutor-1.0.jar --send="caching-approaches-comparison $command" --host=$host --port=5000; do sleep 5; done
- fi
- while ! curl -s $host:8080 > /dev/null; do sleep 5; done
- java $JAVA_OPTS -jar adapters/RequestsSimulator/target/RequestsSimulator-1.0.jar --profile=applications/workloads/$application.json --time=600000 --users=$user --log=applications/workloads/$application-workload-${user}user.json --throughput=applications/output/$application-workload-${user}user-requests --host=$host --home="applications/workloads/" > 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
- command="docker-compose -f applications/uncached/$application/docker-compose.yml down -v"
- while ! java -jar adapters/RemoteExecutor/target/RemoteExecutor-1.0.jar --send="caching-approaches-comparison $command" --host=$host --port=5000; do sleep 5; done
- sleep 30
- fi
- fi
if [[ -f applications/output/$application-$version-${user}user-${execution}execution-requests ]]; then
echo "$(date '+%F %T') Skipping $application with $user users and execution $execution"
else
echo "$(date '+%F %T') Running $application with $user users and execution $execution"
- if [[ $host = "localhost" ]]; then
- export TRACER_ENABLE=false
- export CACHE_EVENTS=false
- docker-compose -f applications/$version/$application/docker-compose.yml up -d --build
- else
- command="JAVA_OPTS=$JAVA_SERVER_OPTS TRACER_ENABLE=false CACHE_EVENTS=false docker-compose -f applications/$version/$application/docker-compose.yml up -d --build"
- while ! java -jar adapters/RemoteExecutor/target/RemoteExecutor-1.0.jar --send="caching-approaches-comparison $command" --host=$host --port=5000; do sleep 5; done
- fi
+ command="JAVA_OPTS=$JAVA_SERVER_OPTS TRACER_ENABLE=false CACHE_EVENTS=false docker-compose -f applications/$version/$application/docker-compose.yml up -d --build"
+ execute "$host" "$command"
while ! curl -s $host:8080 > /dev/null; do sleep 5; done
timeout 750 java $JAVA_OPTS -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 --home="applications/workloads/" > applications/output/$application-$version-${user}user-${execution}execution-simulator.log 2>&1
- if [[ $host = "localhost" ]]; then
- docker-compose -f applications/$version/$application/docker-compose.yml down -v
- else
- command="docker-compose -f applications/$version/$application/docker-compose.yml down -v"
- while ! java -jar adapters/RemoteExecutor/target/RemoteExecutor-1.0.jar --send="caching-approaches-comparison $command" --host=$host --port=5000; do sleep 5; done
- sleep 30
- fi
+ command="docker-compose -f applications/$version/$application/docker-compose.yml down -v"
+ execute "$host" "$command"
+ sleep 30
fi
done
+ if [[ $version = "uncached" ]]; then
+ echo "$(date '+%F %T') Skipping uncached version of $application with $user users"
+ elif [[ -f applications/output/$application-cachemetrics-$version-${user}user-requests ]]; then
+ echo "$(date '+%F %T') Skipping measure of caching performance for $application with $user users"
+ else
+ echo "$(date '+%F %T') Running measure of caching performance for $application with $user users"
+ command="JAVA_OPTS=$JAVA_SERVER_OPTS TRACER_ENABLE=false CACHE_EVENTS=/caching-approaches-comparison/applications/output/$application-$version-${user}user-cache docker-compose -f applications/$version/$application/docker-compose.yml up -d --build"
+ execute "$host" "$command"
+ while ! curl -s $host:8080 > /dev/null; do sleep 5; done
+ timeout 750 java $JAVA_OPTS -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-cachemetrics-$version-${user}user-requests --host=$host --home="applications/workloads/" > applications/output/$application-cachemetrics-$version-${user}user-simulator.log 2>&1
+ command="docker-compose -f applications/$version/$application/docker-compose.yml down -v"
+ execute "$host" "$command"
+ sleep 30
+ fi
done
done
done
trace.sh 21(+7 -14)
diff --git a/trace.sh b/trace.sh
index 1676b8b..2375b44 100644
--- a/trace.sh
+++ b/trace.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+source functions.sh
+
if [ "$(whoami)" != 'root' ]; then
echo "You have no permission to run $0 as non-root user."
exit 1;
@@ -24,21 +26,12 @@ for application in $applications; do
echo "$(date '+%F %T') Skipping application $application"
else
echo "$(date '+%F %T') Running application $application"
- if [[ $host = "localhost" ]]; then
- export TRACER_ENABLE=true
- docker-compose -f applications/uncached/$application/docker-compose.yml up -d --build
- else
- command="JAVA_OPTS=$JAVA_SERVER_OPTS TRACER_ENABLE=true docker-compose -f applications/uncached/$application/docker-compose.yml up -d --build"
- while ! java -jar adapters/RemoteExecutor/target/RemoteExecutor-1.0.jar --send="caching-approaches-comparison $command" --host=$host --port=5000; do sleep 5; done
- fi
+ command="JAVA_OPTS=$JAVA_SERVER_OPTS TRACER_ENABLE=true docker-compose -f applications/uncached/$application/docker-compose.yml up -d --build"
+ execute "$host" "$command"
while ! curl -s $host:8080 > /dev/null; do sleep 5; done
java $JAVA_OPTS -jar adapters/RequestsSimulator/target/RequestsSimulator-1.0.jar --profile=applications/workloads/$application.json --time=300000 --users=1 --log=applications/workloads/$application-execution-uncached.json --throughput=applications/output/$application-uncached-requests --host=$host --home="applications/workloads/" > applications/output/$application-uncached-simulator.log 2>&1
- if [[ $host = "localhost" ]]; then
- docker-compose -f applications/uncached/$application/docker-compose.yml down -v
- else
- command="docker-compose -f applications/uncached/$application/docker-compose.yml down -v"
- while ! java -jar adapters/RemoteExecutor/target/RemoteExecutor-1.0.jar --send="caching-approaches-comparison $command" --host=$host --port=5000; do sleep 5; done
- sleep 30
- fi
+ command="docker-compose -f applications/uncached/$application/docker-compose.yml down -v"
+ execute "$host" "$command"
+ sleep 30
fi
done