Skip to content
Snippets Groups Projects
Commit b17c9efe authored by Ubuntu's avatar Ubuntu
Browse files

updating Graphs

parent 8ba97586
No related branches found
No related tags found
No related merge requests found
Graphs.py 100644 → 100755
...@@ -9,22 +9,23 @@ import os ...@@ -9,22 +9,23 @@ import os
#get the list of files in the directory with .txt extension #get the list of files in the directory with .txt extension
files = [f for f in os.listdir('.') if os.path.isfile(f)] files = [f for f in os.listdir('.') if os.path.isfile(f)]
files = [f for f in files if f.endswith('.txt')] files = [f for f in files if f.endswith('.txt')]
db_name= file.split('_')[0] db_name= files[0].split('_')[0]
d = defaultdict(lambda:[0,0]) d = defaultdict(lambda:[0,0])
dr_latency = {10:[],50:[],100:[],500:[]} dr_latency = {10:[],50:[],100:[],500:[]}
dr_latency_per_vm = defaultdict(lambda:0) dr_latency_per_vm = defaultdict(lambda:0)
du_latency = {10:[],50:[],100:[],500:[]} du_latency = {10:[],50:[],100:[],500:[]}
no_of_vms = 0
for file in files: for file in files:
if('load' in file): if('load' in file):
continue continue
#open the file
f = open(file, 'r') f = open(file, 'r')
vm=file.split('_')[-1].split('.')[0] vm=file.split('_')[-1].split('.')[0]
vm=int(vm) vm=int(vm)
no_of_vms = max(no_of_vms, vm)
thread_count=file.split('_')[-2] thread_count=file.split('_')[-2]
thread_count=int(thread_count) thread_count=int(thread_count)
...@@ -107,15 +108,15 @@ tup=[] ...@@ -107,15 +108,15 @@ tup=[]
for i in d: for i in d:
tup.append([d[i][1],i[0],d[i][0]]) tup.append([d[i][1],i[0],d[i][0]])
tup.sort(key=lambda x:(x[0],x[1])) tup.sort(key=lambda x:(x[0],x[1]))
for i in tup:
print(i)
keys=[10,50,100,500] keys=[10,50,100,500]
final_dict={} final_dict={}
for _ in keys: for _ in keys:
final_dict[_]=[] final_dict[_]=[]
for i in range(5): for i in range(no_of_vms):
if len(tup)==0:
break
tmp=tup.pop(0) tmp=tup.pop(0)
final_dict[_].append([tmp[1],tmp[2]]) final_dict[_].append([tmp[1],tmp[2]])
final_dict[_].sort() final_dict[_].sort()
...@@ -133,7 +134,6 @@ for threads in final_dict: ...@@ -133,7 +134,6 @@ for threads in final_dict:
data = final_dict2 data = final_dict2
threads = sorted(data['Threads'].keys()) threads = sorted(data['Threads'].keys())
vms = sorted(set(data['Threads'][threads[0]]['VMs'])) vms = sorted(set(data['Threads'][threads[0]]['VMs']))
throughputs = {vm: [data['Threads'][thread]['Throughput'][vm-1] for thread in threads] for vm in vms} throughputs = {vm: [data['Threads'][thread]['Throughput'][vm-1] for thread in threads] for vm in vms}
......
...@@ -20,11 +20,11 @@ workload = args.workload ...@@ -20,11 +20,11 @@ workload = args.workload
def get_load_command(db, load, vm): def get_load_command(db, load, vm):
ret =[] ret =[]
if db=="redis": if db=="redis":
for thread in [10]: for thread in [10, 50, 100, 500]:
threads=thread//vm threads=thread//vm
ret.append("./bin/ycsb load redis -p recordcount={} -p redis.host='{}' -p redis.port=6379 -P workloads/workload{} -p redis.cluster=true > /tmp/redis_load_out_{}_{}.txt".format(load//vm, endpoint, workload, threads, vm)) ret.append("./bin/ycsb load redis -p recordcount={} -p redis.host='{}' -p redis.port=6379 -P workloads/workload{} -p redis.cluster=true > /tmp/redis_load_out_{}_{}.txt".format(load//vm, endpoint, workload, threads, vm))
elif db=="memcached": elif db=="memcached":
for thread in [10]: for thread in [10, 50, 100, 500]:
threads=thread//vm threads=thread//vm
ret.append("./bin/ycsb load memcached -p recordcount={} -P workloads/workload{} -p memcached.hosts={}:11211> /tmp/memcached_load_out_{}_{}.txt".format(load//vm, workload, endpoint, threads, vm)) ret.append("./bin/ycsb load memcached -p recordcount={} -P workloads/workload{} -p memcached.hosts={}:11211> /tmp/memcached_load_out_{}_{}.txt".format(load//vm, workload, endpoint, threads, vm))
return ret[0] return ret[0]
...@@ -32,11 +32,11 @@ def get_load_command(db, load, vm): ...@@ -32,11 +32,11 @@ def get_load_command(db, load, vm):
def get_run_command(db, load, vm): def get_run_command(db, load, vm):
ret =[] ret =[]
if db=="redis": if db=="redis":
for thread in [10,50,100,500]: for thread in [10, 50, 100, 500]:
threads=thread//vm threads=thread//vm
ret.append("./bin/ycsb run redis -p operationcount={} -p redis.host='{}' -p redis.port=6379 -P workloads/workload{} -p redis.cluster=true> /tmp/redis_run_out_{}_{}.txt".format(load//vm, endpoint, workload, threads, vm)) ret.append("./bin/ycsb run redis -p operationcount={} -p redis.host='{}' -p redis.port=6379 -P workloads/workload{} -p redis.cluster=true> /tmp/redis_run_out_{}_{}.txt".format(load//vm, endpoint, workload, threads, vm))
elif db=="memcached": elif db=="memcached":
for thread in [10,50,100,500]: for thread in [10, 50, 100, 500]:
threads=thread//vm threads=thread//vm
ret.append("./bin/ycsb run memcached -p operationcount={} -P workloads/workload{} -p memcached.hosts={}:11211> /tmp/memcached_run_out_{}_{}.txt".format(load//vm, workload, endpoint, threads, vm)) ret.append("./bin/ycsb run memcached -p operationcount={} -P workloads/workload{} -p memcached.hosts={}:11211> /tmp/memcached_run_out_{}_{}.txt".format(load//vm, workload, endpoint, threads, vm))
return ret return ret
...@@ -56,4 +56,6 @@ for vm in range(1,max_vms+1): ...@@ -56,4 +56,6 @@ for vm in range(1,max_vms+1):
if thread==10//vm: if thread==10//vm:
os.system("sudo scp -o StrictHostKeyChecking=no -i cca.pem ec2-user@{}:/tmp/{}_load_out_{}_{}.txt ./{}_load_out_{}_{}_{}.txt".format(ip, db, threads, vm, db, rep_ip, threads, vm)) os.system("sudo scp -o StrictHostKeyChecking=no -i cca.pem ec2-user@{}:/tmp/{}_load_out_{}_{}.txt ./{}_load_out_{}_{}_{}.txt".format(ip, db, threads, vm, db, rep_ip, threads, vm))
os.system("sudo scp -o StrictHostKeyChecking=no -i cca.pem ec2-user@{}:/tmp/{}_run_out_{}_{}.txt ./{}_run_out_{}_{}_{}.txt".format(ip, db, threads, vm, db, rep_ip, threads, vm)) os.system("sudo scp -o StrictHostKeyChecking=no -i cca.pem ec2-user@{}:/tmp/{}_run_out_{}_{}.txt ./{}_run_out_{}_{}_{}.txt".format(ip, db, threads, vm, db, rep_ip, threads, vm))
os.system("sudo terraform destroy -var='instance_count={}' -var='runcmd1={}' -var='runcmd2={}' -var='runcmd3={}' -var='runcmd4={}' -var='loadcmd={}' -auto-approve".format(vm, run_commands[0], run_commands[1], run_commands[2], run_commands[3], get_load_command(db, load, vm))) os.system("sudo terraform destroy -var='instance_count={}' -var='runcmd1={}' -var='runcmd2={}' -var='runcmd3={}' -var='runcmd4={}' -var='loadcmd={}' -auto-approve".format(vm, run_commands[0], run_commands[1], run_commands[2], run_commands[3], get_load_command(db, load, vm)))
\ No newline at end of file
os.system("sudo python3 Graphs.py")
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment