diff --git a/benchmark/classic/benchmark.sh b/benchmark/classic/benchmark.sh index d6c87a4..33d24fc 100644 --- a/benchmark/classic/benchmark.sh +++ b/benchmark/classic/benchmark.sh @@ -4,10 +4,10 @@ #.body (even if you don't need it) #Configuration variables -functions=(isprime-scale isprime-scale-py isprime-scale-js hello-scale hello-scale-py hello-scale-js hello hello-js hello-py isprime isprime-js isprime-py) +functions=(isprime-kubeless-go-sc) connections=(1000) times=(1m) -kuberhost="node1:30765" +kuberhost="node1:31299" maxthreads=40 #Wave mode configuration wave_connection=40 @@ -16,18 +16,6 @@ wave_min_conn=40 wave_time="1m" wave_loop_max=2 -WRK_INSTALLED=$(command -v wrk) -if [[ $WRK_INSTALLED = "" ]] -then - apt update - apt install build-essential libssl-dev git -y - git clone https://github.com/wg/wrk.git wrk - cd wrk || exit - cores=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l) - make -j $((cores + 1)) - cp wrk /usr/local/bin -fi - HEY_INSTALLED=$(command -v hey) if [[ $HEY_INSTALLED = "" ]] then @@ -91,11 +79,6 @@ do do datetime=$(date '+%Y-%m-%d-%H-%M-%S') echo -e "Time: $time\n" - if [[ $* = *"--wrk"* ]] - then - echo -e "wrk $datetime\n" - wrk -t$threads -c"$connection" -d"$time" -s"$function_friendly".wrk -H"Host: $function.kubeless" -H"Content-Type:application/json" --latency http://$kuberhost/"$function" > ./data/"$function"."$connection"."$time"."$datetime".wrk.txt 2>&1 - fi if [[ $* = *"--hey"* ]] then echo -e "hey-summary $datetime\n" @@ -111,5 +94,3 @@ do done fi done - -python3 ./data/process.py > ./data/processed.txt diff --git a/benchmark/classic/data/process.py b/benchmark/classic/data/process.py new file mode 100644 index 0000000..87bfd0c --- /dev/null +++ b/benchmark/classic/data/process.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +import csv +import os +from pprint import pprint +import numpy as np +import matplotlib.pyplot as plt + +#Returns array of csv files in current directory +def getFiles(): + files = [f for f in os.listdir('.') if os.path.isfile(f)] + return[ f for f in files if f.endswith('.csv') ] + +def processFile(fname): + with open(fname,'r') as f: + lines=[] + data=csv.reader(f) + fields=next(data) + responseCodes={} + responsePerSec={} + responseTimes=[] + for row in data: + items=zip(fields,row) + item={} + for(name,value) in items: + item[name]=value.strip() + sec=int(item['offset'].split('.')[0]) + if sec not in responsePerSec: + responsePerSec[sec]=[] + else: + responsePerSec[sec].append(item['response-time']) + code=item['status-code'] + if code not in responseCodes: + responseCodes[code]=1 + else: + responseCodes[code]=responseCodes[code]+1 + responseTimes.append(item['response-time']) + if len(responseTimes)!=0: + maxResponse=max(responseTimes) + minResponse=min(responseTimes) + print("Maximum response time was ",maxResponse) + print("Minimum response time was ",minResponse) + else: + print("csv is empty") + pprint(responseCodes) + for sec in responsePerSec: + if len(responsePerSec[sec])!=0: + print(sec, ":") + print(" Maximum:", max(responsePerSec[sec])) + print(" Minimum:", min(responsePerSec[sec])) + print(" Num of responses:", len(responsePerSec[sec])) + else: + print(" empty") + +def processAllFiles(): + files=getFiles() + for f in files: + print("Processing ", f) + processFile(f) + +if __name__ == "__main__": + processAllFiles() diff --git a/benchmark/classic/data/requirements.txt b/benchmark/classic/data/requirements.txt new file mode 100644 index 0000000..aa094d9 --- /dev/null +++ b/benchmark/classic/data/requirements.txt @@ -0,0 +1,2 @@ +numpy +matplotlib diff --git a/benchmark/classic/hello.wrk b/benchmark/classic/hello.wrk deleted file mode 100644 index ecfad3a..0000000 --- a/benchmark/classic/hello.wrk +++ /dev/null @@ -1 +0,0 @@ -wrk.method = "GET" diff --git a/benchmark/classic/isprime.wrk b/benchmark/classic/isprime.wrk deleted file mode 100644 index fdb0082..0000000 --- a/benchmark/classic/isprime.wrk +++ /dev/null @@ -1,26 +0,0 @@ -wrk.method = "POST" -wrk.body = "107107" -done = function(summary, latency, requests) - -- open output file - f = io.open("result.csv", "a+") - - -- write below results to file - -- minimum latency - -- max latency - -- mean of latency - -- standard deviation of latency - -- 50percentile latency - -- 90percentile latency - -- 99percentile latency - -- 99.999percentile latency - -- duration of the benchmark - -- total requests during the benchmark - -- total received bytes during the benchmark - - f:write(string.format("%f,%f,%f,%f,%f,%f,%f,%f,%d,%d,%d\n", - latency.min, latency.max, latency.mean, latency.stdev, latency:percentile(50), - latency:percentile(90), latency:percentile(99), latency:percentile(99.999), - summary["duration"], summary["requests"], summary["bytes"])) - - f:close() -end diff --git a/benchmark/classic/report.lua b/benchmark/classic/report.lua deleted file mode 100644 index 20dd9db..0000000 --- a/benchmark/classic/report.lua +++ /dev/null @@ -1,24 +0,0 @@ -done = function(summary, latency, requests) - -- open output file - f = io.open("result.csv", "a+") - - -- write below results to file - -- minimum latency - -- max latency - -- mean of latency - -- standard deviation of latency - -- 50percentile latency - -- 90percentile latency - -- 99percentile latency - -- 99.999percentile latency - -- duration of the benchmark - -- total requests during the benchmark - -- total received bytes during the benchmark - - f:write(string.format("%f,%f,%f,%f,%f,%f,%f,%f,%d,%d,%d\n", - latency.min, latency.max, latency.mean, latency.stdev, latency:percentile(50), - latency:percentile(90), latency:percentile(99), latency:percentile(99.999), - summary["duration"], summary["requests"], summary["bytes"])) - - f:close() -end