From f8231317f08a5deeb006fa6c869775a6f87aeb39 Mon Sep 17 00:00:00 2001 From: Chia-Che Tsai Date: Fri, 25 Aug 2017 16:32:09 -0400 Subject: [PATCH] fix the building scripts of apache --- LibOS/shim/test/apps/apache/Makefile | 2 +- LibOS/shim/test/apps/apache/benchmark-ab.sh | 41 +++++++++++++++++++ .../test/apps/apache/httpd.manifest.template | 4 ++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 LibOS/shim/test/apps/apache/benchmark-ab.sh diff --git a/LibOS/shim/test/apps/apache/Makefile b/LibOS/shim/test/apps/apache/Makefile index dc67276e..b8dd6393 100644 --- a/LibOS/shim/test/apps/apache/Makefile +++ b/LibOS/shim/test/apps/apache/Makefile @@ -74,7 +74,7 @@ build-modules: $(INSTALL_DIR)/modules/mod_auth_basic_sandbox.so $(INSTALL_DIR)/modules/mod_auth_basic_sandbox.so: mod_auth_basic_sandbox.c $(INSTALL_DIR)/bin/apxs $(INSTALL_DIR)/bin/apxs $(APXS_FLAGS) \ -S CFLAGS="-I$(SHIMDIR)/../include" \ - -S LDFLAGS="-L$(LIBCDIR)/libos -llibos" -c -i -A $< + -S LDFLAGS="-L. -l:$(RUNTIME)/liblibos.so.1" -c -i -A $< build-conf: [ -f $(INSTALL_DIR)/conf/httpd.conf.old ] || \ diff --git a/LibOS/shim/test/apps/apache/benchmark-ab.sh b/LibOS/shim/test/apps/apache/benchmark-ab.sh new file mode 100755 index 00000000..e108bb66 --- /dev/null +++ b/LibOS/shim/test/apps/apache/benchmark-ab.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +declare -A THROUGHPUTS +declare -A LATENCIES +LOOP=5 +DOWNLOAD_HOST=$1 +DOWNLOAD_FILE=random/10K.1.html +REQUESTS=10000 +CONCURRENCY_LIST="1 2 4 8 16 32 64 128 256" +RESULT=result-$(date +%y%m%d-%H%M%S) + +touch $RESULT + +RUN=0 +while [ $RUN -lt $LOOP ] +do + for CONCURRENCY in $CONCURRENCY_LIST + do + rm -f OUTPUT + echo "ab -n $REQUESTS -c $CONCURRENCY http://$DOWNLOAD_HOST/$DOWNLOAD_FILE" + ab -n $REQUESTS -c $CONCURRENCY http://$DOWNLOAD_HOST/$DOWNLOAD_FILE > OUTPUT + + sleep 5 + + THROUGHPUT=$(grep -m1 "Requests per second:" OUTPUT | awk '{ print $4 }') + LATENCY=$(grep -m1 "Time per request:" OUTPUT | awk '{ print $4 }') + THROUGHPUTS[$CONCURRENCY]="${THROUGHPUTS[$CONCURRENCY]} $THROUGHPUT" + LATENCIES[$CONCURRENCY]="${LATENCIES[$CONCURRENCY]} $LATENCY" + echo "concurrency=$CONCURRENCY, throughput=$THROUGHPUT, latency=$LATENCY" + done + RUN=$(expr $RUN + 1) +done + +for CONCURRENCY in $CONCURRENCY_LIST +do + THROUGHPUT=$(echo ${THROUGHPUTS[$CONCURRENCY]} | tr " " "\n" | sort -n | awk '{a[NR]=$0}END{if(NR%2==1)print a[int(NR/2)+1];else print(a[NR/2-1]+a[NR/2])/2}') + LATENCY=$(echo ${LATENCIES[$CONCURRENCY]} | tr " " "\n" | sort -n | awk '{a[NR]=$0}END{if(NR%2==1)print a[int(NR/2)+1];else print(a[NR/2-1]+a[NR/2])/2}') + echo "$THROUGHPUT,$LATENCY" >> $RESULT +done + +echo "Result file: $RESULT" diff --git a/LibOS/shim/test/apps/apache/httpd.manifest.template b/LibOS/shim/test/apps/apache/httpd.manifest.template index 3a990e5f..4d5fec71 100644 --- a/LibOS/shim/test/apps/apache/httpd.manifest.template +++ b/LibOS/shim/test/apps/apache/httpd.manifest.template @@ -44,6 +44,10 @@ sgx.trusted_files.libxml2 = file:/usr/lib/x86_64-linux-gnu/libxml2.so.2 sgx.trusted_files.libz = file:/lib/x86_64-linux-gnu/libz.so.1 sgx.trusted_files.liblzma = file:/lib/x86_64-linux-gnu/liblzma.so.5 sgx.trusted_files.libnsl = file:/lib/x86_64-linux-gnu/libnsl.so.1 +sgx.trusted_files.libicuuc = file:/usr/lib/x86_64-linux-gnu/libicuuc.so.55 +sgx.trusted_files.libicudata = file:/usr/lib/x86_64-linux-gnu/libicudata.so.55 +sgx.trusted_files.libstdcpp = file:/usr/lib/x86_64-linux-gnu/libstdc++.so.6 +sgx.trusted_files.libgcc_c = file:/lib/x86_64-linux-gnu/libgcc_s.so.1 sgx.allowed_files.modules = file:obj/modules sgx.allowed_files.conf = file:obj/conf