From bbf96f4560ecbe76465da49da0af733dcff734e0 Mon Sep 17 00:00:00 2001 From: Michael Giardino Date: Thu, 9 Jul 2015 11:41:14 -0700 Subject: [PATCH] Added a number of scripts for running multitier anticaching as well as plotting results. --- graphs/average-throughput-articles.py | 745 ++++++++++++++++++++++ graphs/average-throughput.py | 90 +-- graphs/evictions-timeline-articles.py | 559 ++++++++++++++++ graphs/evictions-timeline-voter.py | 33 +- graphs/evictions-timeline-ycsb.py | 19 +- scripts/multitier/articles-multitier.sh | 259 ++++++++ scripts/multitier/voter-multitier.sh | 254 ++++++++ scripts/multitier/ycsb-old.sh | 212 ++++++ scripts/multitier/ycsb-single-tier-nvm.sh | 251 ++++++++ 9 files changed, 2355 insertions(+), 67 deletions(-) create mode 100755 graphs/average-throughput-articles.py create mode 100755 graphs/evictions-timeline-articles.py create mode 100755 scripts/multitier/articles-multitier.sh create mode 100755 scripts/multitier/voter-multitier.sh create mode 100755 scripts/multitier/ycsb-old.sh create mode 100755 scripts/multitier/ycsb-single-tier-nvm.sh diff --git a/graphs/average-throughput-articles.py b/graphs/average-throughput-articles.py new file mode 100755 index 0000000000..7681ed449c --- /dev/null +++ b/graphs/average-throughput-articles.py @@ -0,0 +1,745 @@ +#!/usr/bin/env python + +import os +import sys +import re +import logging +import fnmatch +import string +import argparse +import matplotlib +matplotlib.use('Agg') +import pylab +import numpy as np +import matplotlib.pyplot as plot +import matplotlib.ticker as tkr +import math +import locale +from matplotlib.font_manager import FontProperties +from matplotlib.ticker import MaxNLocator +from pprint import pprint,pformat + +from options import * +import graphutil +import datautil + +## ============================================== +## LOGGING CONFIGURATION +## ============================================== + +LOG = logging.getLogger(__name__) +LOG_handler = logging.StreamHandler() +LOG_formatter = logging.Formatter( + fmt='%(asctime)s [%(funcName)s:%(lineno)03d] %(levelname)-5s: %(message)s', + datefmt='%m-%d-%Y %H:%M:%S' +) +LOG_handler.setFormatter(LOG_formatter) +LOG.addHandler(LOG_handler) +LOG.setLevel(logging.INFO) + +## ============================================== +## CONFIGURATION +## ============================================== + +dict = {} +def func(x, pos): # formatter function takes tick label and tick position + + s = '{:0,d}'.format(int(x)) + return s + +def computeEvictionStats(dataFile): + colMap, csvData = datautil.getCSVData(dataFile) + rpos = dataFile.rfind("/"); + pos = dataFile.find("/"); + print dataFile + dataFile = dataFile[0:pos] + dataFile[rpos + 3:] + if len(csvData) == 0: return + + tp = [] + txns = [] + time = [] + if not dict.has_key(dataFile): + dict[dataFile] = [] + + for row in csvData: + txn = float(row[colMap["TRANSACTIONS"]]) + t = float(row[colMap["ELAPSED"]]) + txns.append(txn) + time.append(t) + tp.append(txn/5) + + dict[dataFile].append(np.mean(tp)) + + print " Average Throughput: %.2f txn/s" % np.mean(tp) + print +# DEF# + +def draw_throughput_graph_all(dict, out_path): + fig = plot.figure() + #fig.set_size_inches(8,4.8) + ax = fig.add_subplot(111) + skew = ["S0.8", "S1.01", "S1.1", "S1.2", "S4", "S8"] + res1 = [] + res1_min = [] + res1_max = [] + res2 = [] + res2_min = [] + res2_max = [] + res3 = [] + res3_min = [] + res3_max = [] + res4 = [] + res4_min = [] + res4_max = [] + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("lru") > 0: + res1.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res1_min.append(mean - np.min(dict[tp])) + res1_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("blocking") > 0: + res2.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res2_min.append(mean - np.min(dict[tp])) + res2_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + #for s in skew: + # for tp in dict: + # if tp.find(s + '-') > 0 and tp.find("flru") > 0: + # res2.append(np.mean(dict[tp])) + # mean = np.mean(dict[tp]) + # res2_min.append(mean - np.min(dict[tp])) + # res2_max.append(np.max(dict[tp]) - mean) + # print tp + # print np.mean(dict[tp]) + + #for s in skew: + # for tp in dict: + # if tp.find(s + '-') > 0 and tp.find("timestamps") > 0 and tp.find("prime") >= 0: + # res4.append(np.mean(dict[tp])) + # mean = np.mean(dict[tp]) + # res4_min.append(mean - np.min(dict[tp])) + # res4_max.append(np.max(dict[tp]) - mean) + # print tp + # print np.mean(dict[tp]) + #res1 = [2618.45, 17978.96, 30405.52] + #res2 =[6123.74, 28654.0766667, 35181.7266667] + + # \#topic ($K$) & 50 & 100 & 150 \\ \hline %\hline + # TI & 0.7476 & 0.7505 & 0.7349 \\ \hline%\cline{2-4} + # WTM & \multicolumn{3}{c}{0.7705} \\ \hline%\cline{2-4} + # COLD(C=100) & 0.8283 & {\bf 0.8397} & 0.8254 \\ + # \hline + x = [0.5,1,1.5,2] + ax.bar( [i-0.1 for i in x] ,res1,width=0.1,label='aLRU',hatch='\\',color='#FF6600') + ax.errorbar([i-0.05 for i in x], res1, yerr = [res1_min, res1_max], fmt='o') + ax.bar( [i-0.0 for i in x],res2,width=0.1,label='fLRU',hatch='/',color='#4876FF') + ax.errorbar([i+0.05 for i in x], res2, yerr = [res2_min, res2_max], fmt='o') + #ax.bar( [i+0.0 for i in x],res3,width=0.1,label='rTimestamp',hatch='-',color='#99CC00') + #ax.errorbar([i+0.05 for i in x], res3, yerr = [res3_min, res3_max], fmt='o') + #ax.bar( [i+0.1 for i in x],res4,width=0.1,label='timestamp',hatch='\\/',color='#CD0000') + #ax.errorbar([i+0.15 for i in x], res4, yerr = [res4_min, res4_max], fmt='o') + ax.set_ylabel("Transactions per second",fontsize=16,weight='bold') + #ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) + ax.legend(loc='upper center', bbox_to_anchor=(0.5, 1.05),ncol=3) + ax.set_xlim([0.2,2.4]) + ax.set_ylim([0,60000]) + ax.set_xticklabels(["0.8", "1.0", "1.1", "1.2"],fontsize=16) + ax.set_xlabel("Skew factor (Low -> High)",fontsize=16,weight='bold') + ax.set_xticks([0.5,1,1.5,2]) + y_format = tkr.FuncFormatter(func) # make formatter + ax.yaxis.set_major_formatter(y_format) # set formatter to needed axis + #plt.show() + plot.savefig(out_path) + +def draw_throughput_block_sync_vs_abrt(dict, out_path): + fig = plot.figure() + #fig.set_size_inches(8,4.8) + ax = fig.add_subplot(111) + skew = ["S0.8", "S1.01", "S1.1","S1.25"] + res1 = [] + res1_min = [] + res1_max = [] + res2 = [] + res2_min = [] + res2_max = [] + res3 = [] + res3_min = [] + res3_max = [] + res4 = [] + res4_min = [] + res4_max = [] + res5 = [] + res5_min = [] + res5_max = [] + res6 = [] + res6_min = [] + res6_max = [] + + print dict + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("-1c-") > 0 and tp.find("block") > 0 and tp.find("sync") > 0: + res1.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res1_min.append(mean - np.min(dict[tp])) + res1_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("-1c-") > 0 and tp.find("block") > 0 and tp.find("abrt") > 0: + res2.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res2_min.append(mean - np.min(dict[tp])) + res2_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("-10c-") > 0 and tp.find("block") > 0 and tp.find("sync") > 0: + res3.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res3_min.append(mean - np.min(dict[tp])) + res3_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("-10c-") > 0 and tp.find("block") > 0 and tp.find("abrt") > 0: + res4.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res4_min.append(mean - np.min(dict[tp])) + res4_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("-50c-") > 0 and tp.find("block") > 0 and tp.find("sync") > 0: + res5.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res5_min.append(mean - np.min(dict[tp])) + res5_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("-50c-") > 0 and tp.find("block") > 0 and tp.find("abrt") > 0: + res6.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res6_min.append(mean - np.min(dict[tp])) + res6_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + + x = [0.5,1,1.5,2] + print res1 + print res2 + print res3 + print res4 + print res5 + print res6 + + tmp1 = max(res6) + tmp2 = max(res5) + tmp = max(tmp1, tmp2) + print tmp + order = 1 + + while tmp > 10: + order = order * 10 + tmp = tmp / 10 + y_max_range = math.ceil(tmp) * order + + print y_max_range + + ax.bar( [i-0.3 for i in x] ,res1,width=0.1,label='1c sync',hatch='\\\\\\',color='#0000CC') + ax.errorbar([i-0.25 for i in x], res1, yerr = [res1_min, res1_max], fmt='o') + ax.bar( [i-0.2 for i in x],res2,width=0.1,label='1c abrt',hatch='///',color='#FF0000') + ax.errorbar([i-0.15 for i in x], res2, yerr = [res2_min, res2_max], fmt='o') + ax.bar( [i-0.1 for i in x] ,res3,width=0.1,label='10c sync',hatch='+++',color='#8080E6') + ax.errorbar([i-0.05 for i in x], res3, yerr = [res3_min, res3_max], fmt='o') + ax.bar( [i for i in x],res4,width=0.1,label='10c abrt',hatch='XXX',color='#FF8080') + ax.errorbar([i+0.05 for i in x], res4, yerr = [res4_min, res4_max], fmt='o') + ax.bar( [i+0.1 for i in x] ,res5,width=0.1,label='50c sync',hatch='---',color='#CCCCF5') + ax.errorbar([i+0.15 for i in x], res5, yerr = [res5_min, res5_max], fmt='o') + ax.bar( [i+0.2 for i in x],res6,width=0.1,label='50c abrt',hatch='...',color='#FFC0C0') + ax.errorbar([i+0.25 for i in x], res6, yerr = [res6_min, res6_max], fmt='o') + ax.set_ylabel("Transactions per second",fontsize=16,weight='bold') + #ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) + lgd = ax.legend(loc=3, bbox_to_anchor=(0.,1, 1, .1),mode="expand", ncol=3) + ax.set_xlim([0.2,3.2]) + ax.set_ylim([0, y_max_range]) + ax.set_xticklabels(["0.8", "1.01","1.1", "1.25"],fontsize=16) + ax.set_xlabel("Skew factor (Low -> High)",fontsize=16,weight='bold') + ax.set_xticks([0.5,1.5,2.5]) + y_format = tkr.FuncFormatter(func) # make formatter + ax.yaxis.set_major_formatter(y_format) # set formatter to needed axis + #plt.show() + print out_path + plot.savefig(out_path, bbox_extra_artists=(lgd,), bbox_inches='tight') + +def draw_throughput_sync_tuple_vs_block(dict, out_path): + fig = plot.figure() + #fig.set_size_inches(8,4.8) + ax = fig.add_subplot(111) + skew = ["S0.8", "S1.01", "S1.25", "S4", "S8"] + res1 = [] + res1_min = [] + res1_max = [] + res2 = [] + res2_min = [] + res2_max = [] + res3 = [] + res3_min = [] + res3_max = [] + res4 = [] + res4_min = [] + res4_max = [] + res5 = [] + res5_min = [] + res5_max = [] + res6 = [] + res6_min = [] + res6_max = [] + + print dict +# for s in skew: +# for tp in dict: +# if tp.find(s + '-') > 0 and tp.find("-1c-") > 0 and tp.find("tuple") > 0 and tp.find("sync") > 0: +# #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("BERKELEY") > 0: +# res1.append(np.mean(dict[tp])) +# mean = np.mean(dict[tp]) +# res1_min.append(mean - np.min(dict[tp])) +# res1_max.append(np.max(dict[tp]) - mean) +# print tp +# print np.mean(dict[tp]) + +# for s in skew: +# for tp in dict: +# #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("NVM") > 0: +# if tp.find(s + '-') > 0 and tp.find("-1c-") > 0 and tp.find("block") > 0 and tp.find("sync") > 0: +# res2.append(np.mean(dict[tp])) +# mean = np.mean(dict[tp]) +# res2_min.append(mean - np.min(dict[tp])) +# res2_max.append(np.max(dict[tp]) - mean) +# print tp +# print np.mean(dict[tp]) + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("-10c-") > 0 and tp.find("tuple") > 0 and tp.find("sync") > 0: + #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("BERKELEY") > 0: + res3.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res3_min.append(mean - np.min(dict[tp])) + res3_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("NVM") > 0: + if tp.find(s + '-') > 0 and tp.find("-10c-") > 0 and tp.find("block") > 0 and tp.find("sync") > 0: + res4.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res4_min.append(mean - np.min(dict[tp])) + res4_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + +# for s in skew: +# for tp in dict: +# if tp.find(s + '-') > 0 and tp.find("-50c-") > 0 and tp.find("tuple") > 0 and tp.find("sync") > 0: + #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("BERKELEY") > 0: +# res5.append(np.mean(dict[tp])) +# mean = np.mean(dict[tp]) +# res5_min.append(mean - np.min(dict[tp])) +# res5_max.append(np.max(dict[tp]) - mean) +# print tp +# print np.mean(dict[tp]) + +# for s in skew: +# for tp in dict: +# #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("NVM") > 0: +# if tp.find(s + '-') > 0 and tp.find("-50c-") > 0 and tp.find("block") > 0 and tp.find("sync") > 0: +# res6.append(np.mean(dict[tp])) +# mean = np.mean(dict[tp]) +# res6_min.append(mean - np.min(dict[tp])) +# res6_max.append(np.max(dict[tp]) - mean) +# print tp +# print np.mean(dict[tp]) + + + x = [0.5,1.5,2.5,3.5,4.5] +# print res1 +# print res2 + print res3 + print res4 +# print res5 +# print res6 + + tmp1 = max(res3) + tmp2 = max(res4) + tmp = max(tmp1, tmp2) + print tmp + order = 1 + + while tmp > 10: + order = order * 10 + tmp = tmp / 10 + y_max_range = math.ceil(tmp) * order + + print y_max_range + +# ax.bar( [i-0.3 for i in x] ,res1,width=0.1,label='1c tuple',hatch='\\\\\\',color='#0000CC') +# ax.errorbar([i-0.25 for i in x], res1, yerr = [res1_min, res1_max], fmt='o') +# ax.bar( [i-0.2 for i in x],res2,width=0.1,label='1c block',hatch='///',color='#FF0000') +# ax.errorbar([i-0.15 for i in x], res2, yerr = [res2_min, res2_max], fmt='o') + ax.bar( [i-0.2 for i in x] ,res3,width=0.2,label='10c tuple',hatch='+++',color='#8080E6') + ax.errorbar([i-0.1 for i in x], res3, yerr = [res3_min, res3_max], fmt='o') + ax.bar( [i for i in x],res4,width=0.2,label='10c block',hatch='XXX',color='#FF8080') + ax.errorbar([i+0.1 for i in x], res4, yerr = [res4_min, res4_max], fmt='o') +# ax.bar( [i+0.1 for i in x] ,res5,width=0.1,label='50c tuple',hatch='---',color='#CCCCF5') +# ax.errorbar([i+0.15 for i in x], res5, yerr = [res5_min, res5_max], fmt='o') +# ax.bar( [i+0.2 for i in x],res6,width=0.1,label='50c block',hatch='...',color='#FFC0C0') +# ax.errorbar([i+0.25 for i in x], res6, yerr = [res6_min, res6_max], fmt='o') + ax.set_ylabel("Transactions per second",fontsize=16,weight='bold') + #ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) + lgd = ax.legend(loc=3, bbox_to_anchor=(0.,1, 1, .1),mode="expand", ncol=3) + ax.set_xlim([0.2,5.2]) + ax.set_ylim([0, y_max_range]) + ax.set_xticklabels(["0.8", "1.01", "1.25", "4.0", "8.0"],fontsize=16) + ax.set_xlabel("Skew factor (Low -> High)",fontsize=16,weight='bold') + ax.set_xticks([0.5,1.5,2.5,3.5,4.5]) + y_format = tkr.FuncFormatter(func) # make formatter + ax.yaxis.set_major_formatter(y_format) # set formatter to needed axis + #plt.show() + print out_path + plot.savefig(out_path, bbox_extra_artists=(lgd,), bbox_inches='tight') + +def draw_throughput_graph(dict, out_path): + fig = plot.figure() + #fig.set_size_inches(8,4.8) + ax = fig.add_subplot(111) + skew = ["S0.8", "S1.01", "S1.1", "S1.2"] + res1 = [] + res1_min = [] + res1_max = [] + res2 = [] + res2_min = [] + res2_max = [] + res3 = [] + res3_min = [] + res3_max = [] + res4 = [] + res4_min = [] + res4_max = [] + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("blocking") > 0 and tp.find("non") < 0 and tp.find("BERKELEY") > 0: + res1.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res1_min.append(mean - np.min(dict[tp])) + res1_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("blocking") > 0 and tp.find("non") < 0 and tp.find("NVM") > 0: + res2.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res2_min.append(mean - np.min(dict[tp])) + res2_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("nonblocking") > 0 and tp.find("BERKELEY") > 0: + res3.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res3_min.append(mean - np.min(dict[tp])) + res3_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("nonblocking") > 0 and tp.find("NVM") > 0: + res4.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res4_min.append(mean - np.min(dict[tp])) + res4_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + + + # for s in skew: + # for tp in dict: + # if tp.find(s + '-') > 0 and tp.find("timestamp") > 0: + # res2.append(np.mean(dict[tp])) + # mean = np.mean(dict[tp]) + # res2_min.append(mean - np.min(dict[tp])) + # res2_max.append(np.max(dict[tp]) - mean) + # print tp + # print np.mean(dict[tp]) + + #res1 = [2618.45, 17978.96, 30405.52] + #res2 =[6123.74, 28654.0766667, 35181.7266667] + + # \#topic ($K$) & 50 & 100 & 150 \\ \hline %\hline + # TI & 0.7476 & 0.7505 & 0.7349 \\ \hline%\cline{2-4} + # WTM & \multicolumn{3}{c}{0.7705} \\ \hline%\cline{2-4} + # COLD(C=100) & 0.8283 & {\bf 0.8397} & 0.8254 \\ + # \hline + x = [0.5,1,1.5,2] + # x = [0.8,1.01,1.1,1.2] + print res1 + print res2 + print res3 + print res4 + ax.bar( [i-0.2 for i in x] ,res1,width=0.1,label='blocking - berkeley',hatch='\\',color='#FF6600') + ax.errorbar([i-0.15 for i in x], res1, yerr = [res1_min, res1_max], fmt='o') + ax.bar( [i-0.1 for i in x],res2,width=0.1,label='blocking - nvm',hatch='/',color='#99CC00') + ax.errorbar([i-0.05 for i in x], res2, yerr = [res2_min, res2_max], fmt='o') + ax.bar( [i+0.0 for i in x],res3,width=0.1,label='non-blocking - berkeley',hatch='-',color='#4876FF') + ax.errorbar([i+0.05 for i in x], res3, yerr = [res3_min, res3_max], fmt='o') + ax.bar( [i+0.1 for i in x],res4,width=0.1,label='non-blocking - nvm',hatch='\\/',color='#CD0000') + ax.errorbar([i+0.15 for i in x], res4, yerr = [res4_min, res4_max], fmt='o') + ax.set_ylabel("Transactions per second",fontsize=16,weight='bold') + #ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) + ax.legend(loc='upper center', bbox_to_anchor=(0.5, 1.05),ncol=2) + ax.set_xlim([0.2,2.2]) + ax.set_ylim([0,70000]) + ax.set_xticklabels(["0.8", "1.0", "1.1", "1.2"],fontsize=16) + ax.set_xlabel("Skew factor (Low -> High)",fontsize=16,weight='bold') + ax.set_xticks([0.5,1,1.5,2]) + y_format = tkr.FuncFormatter(func) # make formatter + ax.yaxis.set_major_formatter(y_format) # set formatter to needed axis + #plt.show() + print out_path + plot.savefig(out_path) + +def lru_alru_hstore_evict(dict, out_path): + fig = plot.figure() + #fig.set_size_inches(8,4.8) + ax = fig.add_subplot(111) + skew = ["S0.8", "S1.01", "S1.1", "S1.2"] + res1 = [5000, 18000, 30000, 31000] + res3 = [5000, 20000, 26000, 25000] + + x = [0.5,1,1.5,2] + + ax.bar( [i-0.1 for i in x] ,res1,width=0.1,label='LRU',hatch='\\',color='#4876FF') + ax.bar( [i+0.0 for i in x] ,res3,width=0.1,label='aLRU',hatch='\\',color='#FF6600') + ax.set_ylabel("Transactions per second",fontsize=16,weight='bold') + #ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) + ax.legend(loc='upper center', bbox_to_anchor=(0.5, 1.05),ncol=3) + ax.set_xlim([0.2,2.2]) + ax.set_ylim([0,50000]) + ax.set_xticklabels(["0.75", "1.0", "1.25", "1.5"],fontsize=16) + ax.set_xlabel("Skew factor (Low -> High)",fontsize=16,weight='bold') + ax.set_xticks([0.5,1,1.5,2]) + y_format = tkr.FuncFormatter(func) # make formatter + ax.yaxis.set_major_formatter(y_format) # set formatter to needed axis + #plt.show() + plot.savefig(out_path) + +def lru_alru_hstore(dict, out_path): + fig = plot.figure() + #fig.set_size_inches(8,4.8) + ax = fig.add_subplot(111) + skew = ["S0.8", "S1.01", "S1.1", "S1.2"] + res1 = [8000, 16000, 30000, 31000] + res2 = [39000, 38000, 39000, 36000] + res3 = [38000, 37000, 38000, 31000] + + x = [0.5,1,1.5,2] + + ax.bar( [i-0.1 for i in x] ,res1,width=0.1,label='LRU',hatch='\\',color='#4876FF') + ax.bar( [i-0.0 for i in x],res2,width=0.1,label='H-Store',hatch='/',color='#228B22') + ax.bar( [i+0.1 for i in x] ,res3,width=0.1,label='aLRU',hatch='\\',color='#FF6600') + ax.set_ylabel("Transactions per second",fontsize=16,weight='bold') + #ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) + ax.legend(loc='upper center', bbox_to_anchor=(0.5, 1.05),ncol=3) + ax.set_xlim([0.2,2.2]) + ax.set_ylim([0,50000]) + ax.set_xticklabels(["0.75", "1.0", "1.25", "1.5"],fontsize=16) + ax.set_xlabel("Skew factor (Low -> High)",fontsize=16,weight='bold') + ax.set_xticks([0.5,1,1.5,2]) + y_format = tkr.FuncFormatter(func) # make formatter + ax.yaxis.set_major_formatter(y_format) # set formatter to needed axis + #plt.show() + plot.savefig(out_path) + +def lru_hstore(dict, out_path): + fig = plot.figure() + #fig.set_size_inches(8,4.8) + ax = fig.add_subplot(111) + skew = ["S0.8", "S1.01", "S1.1", "S1.2"] + res1 = [8000, 16000, 30000, 31000] + res2 = [39000, 38000, 39000, 36000] + + x = [0.5,1,1.5,2] + + ax.bar( [i-0.1 for i in x] ,res1,width=0.1,label='LRU',hatch='\\',color='#4876FF') + ax.bar( [i-0.0 for i in x],res2,width=0.1,label='H-Store',hatch='/',color='#228B22') + ax.set_ylabel("Transactions per second",fontsize=16,weight='bold') + #ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) + ax.legend(loc='upper center', bbox_to_anchor=(0.5, 1.05),ncol=3) + ax.set_xlim([0.2,2.2]) + ax.set_ylim([0,50000]) + ax.set_xticklabels(["0.75", "1.0", "1.25", "1.5"],fontsize=16) + ax.set_xlabel("Skew factor (Low -> High)",fontsize=16,weight='bold') + ax.set_xticks([0.5,1,1.5,2]) + y_format = tkr.FuncFormatter(func) # make formatter + ax.yaxis.set_major_formatter(y_format) # set formatter to needed axis + #plt.show() + plot.savefig(out_path) + +def draw_throughput_graph_INF(dict, out_path): + fig = plot.figure() + #fig.set_size_inches(8,4.8) + ax = fig.add_subplot(111) + skew = ["S0.8", "S1.01", "S1.1", "S1.2"] + res1 = [] + res1_min = [] + res1_max = [] + res2 = [] + res2_min = [] + res2_max = [] + res3 = [] + res3_min = [] + res3_max = [] + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("lru") > 0: + res1.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res1_min.append(mean - np.min(dict[tp])) + res1_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]), np.min(dict[tp]), np.max(dict[tp]) + print dict[tp] + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("timestamp") > 0: + res2.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res2_min.append(mean - np.min(dict[tp])) + res2_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("normal") > 0: + res3.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res3_min.append(mean - np.min(dict[tp])) + res3_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + #res1 = [2618.45, 17978.96, 30405.52] + #res2 =[6123.74, 28654.0766667, 35181.7266667] + + # \#topic ($K$) & 50 & 100 & 150 \\ \hline %\hline + # TI & 0.7476 & 0.7505 & 0.7349 \\ \hline%\cline{2-4} + # WTM & \multicolumn{3}{c}{0.7705} \\ \hline%\cline{2-4} + # COLD(C=100) & 0.8283 & {\bf 0.8397} & 0.8254 \\ + # \hline + x = [0.5,1,1.5,2] + ax.bar( [i-0.15 for i in x] ,res1,width=0.1,label='aLRU',hatch='\\',color='#FF6600') + ax.errorbar([i-0.1 for i in x], res1, yerr = [res1_min, res1_max], fmt='o') + ax.bar( [i-0.05 for i in x],res2,width=0.1,label='timestamps',hatch='/',color='#99CC00') + ax.errorbar([i-0.0 for i in x], res2, yerr = [res2_min, res2_max], fmt='o') + ax.bar( [i+0.05 for i in x],res3,width=0.1,label='none',hatch='-',color='b') + ax.errorbar([i+0.1 for i in x], res3, yerr = [res3_min, res3_max], fmt='o') + ax.set_ylabel("Transactions per second",fontsize=16,weight='bold') + #ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) + ax.legend(loc='upper center', bbox_to_anchor=(0.5, 1.05),ncol=3) + ax.set_xlim([0.2,2.3]) + ax.set_ylim([0,50000]) + ax.set_xticklabels(["0.8", "1.0", "1.1", "1.2"],fontsize=16) + ax.set_xlabel("Skew factor (Low -> High)",fontsize=16,weight='bold') + ax.set_xticks([0.5,1,1.5,2]) + ax.yaxis.get_major_formatter().set_useLocale("d") + #plt.show() + plot.savefig(out_path) + +## ============================================== +## main +## ============================================== +if __name__ == '__main__': + dict = {} + matches = [] + for root, dirnames, filenames in os.walk("/home/user/giardino/data-hstore/ycsb/ycsb-nvm/1p"): + for filename in fnmatch.filter(filenames, '*results.csv'): + matches.append(os.path.join(root, filename)) + #for root, dirnames, filenames in os.walk("ycsb/ycsb-T750-NoLoop"): + #for root, dirnames, filenames in os.walk("ycsb/ycsb-T500-NoLoop"): + # for filename in fnmatch.filter(filenames, '*results.csv'): + # matches.append(os.path.join(root, filename)) + map(computeEvictionStats, matches) + + #for tp in dict: + # print tp + # print np.mean(dict[tp]) + + #draw_throughput_graph_INF(dict, "ycsb-INF.pdf") + #draw_throughput_graph(dict, "ycsb-T500-NoLoop-blocking-vs-nonblocking-6.pdf") + draw_throughput_sync_tuple_vs_block(dict, "ycsb-1-tier-1p-sync-tuple-vs-block.pdf"); + + dict = {} + matches = [] + for root, dirnames, filenames in os.walk("/home/user/giardino/data-hstore/ycsb/ycsb-nvm/8p"): + for filename in fnmatch.filter(filenames, '*results.csv'): + matches.append(os.path.join(root, filename)) + #for root, dirnames, filenames in os.walk("ycsb/ycsb-T750-NoLoop"): + #for root, dirnames, filenames in os.walk("ycsb/ycsb-T500-NoLoop"): + # for filename in fnmatch.filter(filenames, '*results.csv'): + # matches.append(os.path.join(root, filename)) + map(computeEvictionStats, matches) + + #for tp in dict: + # print tp + # print np.mean(dict[tp]) + + #draw_throughput_graph_INF(dict, "ycsb-INF.pdf") + #draw_throughput_graph(dict, "ycsb-T500-NoLoop-blocking-vs-nonblocking-6.pdf") + #draw_throughput_sync_tuple_vs_block(dict, "ycsb-1-tier-8p-sync-tuple-vs-block.pdf"); + #draw_throughput_graph_all(dict, "ycsb-T500-NoLoop-prime-all.pdf") + #lru_hstore(dict, "lru-hstore.pdf") + #lru_alru_hstore(dict, "lru-alru-hstore.pdf") + #lru_alru_hstore_evict(dict, "lru-alru-hstore-evict.pdf") + + dict = {} + matches = [] + for root, dirnames, filenames in os.walk("/home/user/giardino/data-hstore/ycsb/ycsb-nvm/300s"): + for filename in fnmatch.filter(filenames, '*results.csv'): + matches.append(os.path.join(root, filename)) + + map(computeEvictionStats, matches) + + draw_throughput_block_sync_vs_abrt(dict, "ycsb-1-tier-1p-block-sync-vs-abrt.pdf"); +## MAIN diff --git a/graphs/average-throughput.py b/graphs/average-throughput.py index 7681ed449c..a0f8a83d6e 100755 --- a/graphs/average-throughput.py +++ b/graphs/average-throughput.py @@ -339,61 +339,61 @@ def draw_throughput_sync_tuple_vs_block(dict, out_path): # res2_max.append(np.max(dict[tp]) - mean) # print tp # print np.mean(dict[tp]) - for s in skew: - for tp in dict: - if tp.find(s + '-') > 0 and tp.find("-10c-") > 0 and tp.find("tuple") > 0 and tp.find("sync") > 0: - #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("BERKELEY") > 0: - res3.append(np.mean(dict[tp])) - mean = np.mean(dict[tp]) - res3_min.append(mean - np.min(dict[tp])) - res3_max.append(np.max(dict[tp]) - mean) - print tp - print np.mean(dict[tp]) - - for s in skew: - for tp in dict: - #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("NVM") > 0: - if tp.find(s + '-') > 0 and tp.find("-10c-") > 0 and tp.find("block") > 0 and tp.find("sync") > 0: - res4.append(np.mean(dict[tp])) - mean = np.mean(dict[tp]) - res4_min.append(mean - np.min(dict[tp])) - res4_max.append(np.max(dict[tp]) - mean) - print tp - print np.mean(dict[tp]) - # for s in skew: # for tp in dict: -# if tp.find(s + '-') > 0 and tp.find("-50c-") > 0 and tp.find("tuple") > 0 and tp.find("sync") > 0: +# if tp.find(s + '-') > 0 and tp.find("-10c-") > 0 and tp.find("tuple") > 0 and tp.find("sync") > 0: #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("BERKELEY") > 0: -# res5.append(np.mean(dict[tp])) +# res3.append(np.mean(dict[tp])) # mean = np.mean(dict[tp]) -# res5_min.append(mean - np.min(dict[tp])) -# res5_max.append(np.max(dict[tp]) - mean) +# res3_min.append(mean - np.min(dict[tp])) +# res3_max.append(np.max(dict[tp]) - mean) # print tp # print np.mean(dict[tp]) # for s in skew: # for tp in dict: -# #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("NVM") > 0: -# if tp.find(s + '-') > 0 and tp.find("-50c-") > 0 and tp.find("block") > 0 and tp.find("sync") > 0: -# res6.append(np.mean(dict[tp])) + #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("NVM") > 0: +# if tp.find(s + '-') > 0 and tp.find("-10c-") > 0 and tp.find("block") > 0 and tp.find("sync") > 0: +# res4.append(np.mean(dict[tp])) # mean = np.mean(dict[tp]) -# res6_min.append(mean - np.min(dict[tp])) -# res6_max.append(np.max(dict[tp]) - mean) +# res4_min.append(mean - np.min(dict[tp])) +# res4_max.append(np.max(dict[tp]) - mean) # print tp # print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + if tp.find(s + '-') > 0 and tp.find("-50c-") > 0 and tp.find("tuple") > 0 and tp.find("sync") > 0: + #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("BERKELEY") > 0: + res5.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res5_min.append(mean - np.min(dict[tp])) + res5_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) + + for s in skew: + for tp in dict: + #if tp.find(s + '-') > 0 and tp.find("aseline") > 0 and tp.find("NVM") > 0: + if tp.find(s + '-') > 0 and tp.find("-50c-") > 0 and tp.find("block") > 0 and tp.find("sync") > 0: + res6.append(np.mean(dict[tp])) + mean = np.mean(dict[tp]) + res6_min.append(mean - np.min(dict[tp])) + res6_max.append(np.max(dict[tp]) - mean) + print tp + print np.mean(dict[tp]) x = [0.5,1.5,2.5,3.5,4.5] # print res1 # print res2 - print res3 - print res4 +# print res3 +# print res4 # print res5 # print res6 - tmp1 = max(res3) - tmp2 = max(res4) + tmp1 = max(res5) + tmp2 = max(res6) tmp = max(tmp1, tmp2) print tmp order = 1 @@ -405,18 +405,20 @@ def draw_throughput_sync_tuple_vs_block(dict, out_path): print y_max_range + print res5 + print res6 # ax.bar( [i-0.3 for i in x] ,res1,width=0.1,label='1c tuple',hatch='\\\\\\',color='#0000CC') # ax.errorbar([i-0.25 for i in x], res1, yerr = [res1_min, res1_max], fmt='o') # ax.bar( [i-0.2 for i in x],res2,width=0.1,label='1c block',hatch='///',color='#FF0000') # ax.errorbar([i-0.15 for i in x], res2, yerr = [res2_min, res2_max], fmt='o') - ax.bar( [i-0.2 for i in x] ,res3,width=0.2,label='10c tuple',hatch='+++',color='#8080E6') - ax.errorbar([i-0.1 for i in x], res3, yerr = [res3_min, res3_max], fmt='o') - ax.bar( [i for i in x],res4,width=0.2,label='10c block',hatch='XXX',color='#FF8080') - ax.errorbar([i+0.1 for i in x], res4, yerr = [res4_min, res4_max], fmt='o') -# ax.bar( [i+0.1 for i in x] ,res5,width=0.1,label='50c tuple',hatch='---',color='#CCCCF5') -# ax.errorbar([i+0.15 for i in x], res5, yerr = [res5_min, res5_max], fmt='o') -# ax.bar( [i+0.2 for i in x],res6,width=0.1,label='50c block',hatch='...',color='#FFC0C0') -# ax.errorbar([i+0.25 for i in x], res6, yerr = [res6_min, res6_max], fmt='o') +# ax.bar( [i-0.2 for i in x] ,res3,width=0.2,label='10c tuple',hatch='+++',color='#8080E6') +# ax.errorbar([i-0.1 for i in x], res3, yerr = [res3_min, res3_max], fmt='o') +# ax.bar( [i for i in x],res4,width=0.2,label='10c block',hatch='XXX',color='#FF8080') +# ax.errorbar([i+0.1 for i in x], res4, yerr = [res4_min, res4_max], fmt='o') + ax.bar( [i+0.1 for i in x] ,res5,width=0.1,label='50c tuple',hatch='---',color='#CCCCF5') + ax.errorbar([i+0.15 for i in x], res5, yerr = [res5_min, res5_max], fmt='o') + ax.bar( [i+0.2 for i in x],res6,width=0.1,label='50c block',hatch='...',color='#FFC0C0') + ax.errorbar([i+0.25 for i in x], res6, yerr = [res6_min, res6_max], fmt='o') ax.set_ylabel("Transactions per second",fontsize=16,weight='bold') #ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) lgd = ax.legend(loc=3, bbox_to_anchor=(0.,1, 1, .1),mode="expand", ncol=3) @@ -708,7 +710,7 @@ def draw_throughput_graph_INF(dict, out_path): #draw_throughput_graph_INF(dict, "ycsb-INF.pdf") #draw_throughput_graph(dict, "ycsb-T500-NoLoop-blocking-vs-nonblocking-6.pdf") - draw_throughput_sync_tuple_vs_block(dict, "ycsb-1-tier-1p-sync-tuple-vs-block.pdf"); + draw_throughput_sync_tuple_vs_block(dict, "ycsb-1-tier-1p-50c-sync-tuple-vs-block.pdf"); dict = {} matches = [] diff --git a/graphs/evictions-timeline-articles.py b/graphs/evictions-timeline-articles.py new file mode 100755 index 0000000000..8030d0057f --- /dev/null +++ b/graphs/evictions-timeline-articles.py @@ -0,0 +1,559 @@ +#!/usr/bin/env python + +# Example execution +# export b=tpcc ; export OPT_DATA_EVICTIONS=/home/pavlo/Documents/H-Store/Papers/anticache/data/evictions +# ant compile hstore-benchmark -Dproject=$b -Dclient.interval=500 \ +# -Dsite.anticache_enable=true -Dsite.anticache_profiling=true \ +# -Dclient.output_memory=$OPT_DATA_EVICTIONS/$b-memory.csv \ +# -Dclient.output_csv=$OPT_DATA_EVICTIONS/$b-throughput.csv \ +# -Dclient.output_anticache_history=$OPT_DATA_EVICTIONS/$b-evictions.csv + +import os +import sys +import csv +import glob +import re +import logging +import matplotlib +matplotlib.use('Agg') +import matplotlib.pyplot as plot +import pylab +import numpy as np +import math +import string +from matplotlib.font_manager import FontProperties +from matplotlib.ticker import MaxNLocator, MultipleLocator +from pprint import pprint,pformat + + +from options import * +import graphutil + +## ============================================== +## LOGGING CONFIGURATION +## ============================================== + +LOG = logging.getLogger(__name__) +LOG_handler = logging.StreamHandler() +LOG_formatter = logging.Formatter( + fmt='%(asctime)s [%(funcName)s:%(lineno)03d] %(levelname)-5s: %(message)s', + datefmt='%m-%d-%Y %H:%M:%S' +) +LOG_handler.setFormatter(LOG_formatter) +LOG.addHandler(LOG_handler) +LOG.setLevel(logging.INFO) + +## ============================================== +## DATA CONFIGURATION +## ============================================== + +OPT_GRAPH_HEIGHT = 450 + +## ============================================== +## CREATE THROUGHPUT GRAPH +## ============================================== +def createThroughputGraph(benchmark, data): + y_max = max(data["y_values"]) + + tmp = y_max + order = 1 + + while tmp > 10: + order = order * 10 + tmp = tmp / 10; + + y_max_range = math.ceil(tmp) * order + + # INIT + fig = plot.figure() + ax1 = fig.add_subplot(111) + + # Throughout + ax1.plot(data["x_values"], data["y_values"], + color=OPT_COLORS[0], + linewidth=3.5, + marker='', + ) + +# if len(data["memory"]) > 0: +# memoryX = map(lambda x: x[0], data["memory"]) +# memoryY = map(lambda x: (x[1] / float(1024)), data["memory"]) # MB +# ax2 = ax1.twinx() +# ax2.plot(memoryX, memoryY, +# marker='s', +# markersize=2.0, +# color=OPT_COLORS[1], +# ) +# ax2.set_ylabel(OPT_Y_LABEL_THROUGHPUT, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE) +# for tick in ax2.yaxis.get_major_ticks(): +# tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE) +# tick.label.set_fontname(OPT_FONT_NAME) +# else: +# LOG.warn("Missing memory stats for '%s'" % benchmark) + + # Evictions + if len(data["evictions"]) > 0: + addEvictionLines(ax1, data["evictions"], y_max_range) + LOG.info("Adding eviction lines.") + else: + LOG.warn("Missing eviction history for '%s'" % benchmark) + + # GRID + axes = ax1.get_axes() + axes.set_ylim(0, y_max_range) + axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5) + axes.set_axisbelow(True) + graphutil.makeGrid(ax1) + + # Y-AXIS + ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE, weight='bold') + ax1.yaxis.set_major_locator(MaxNLocator(5)) + ax1.minorticks_on() + for tick in ax1.yaxis.get_major_ticks(): + tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE) + tick.label.set_fontname(OPT_FONT_NAME) + + # X-AXIS + ax1.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE, weight='bold') + ax1.set_xlim(0, 600000) + ax1.xaxis.set_major_locator(MaxNLocator(6)) + xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks()) + ax1.set_xticklabels(xLabels) + for tick in ax1.xaxis.get_major_ticks(): + tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE) + tick.label.set_fontname(OPT_FONT_NAME) + + + return (fig) +## DEF + +## ============================================== +## CREATE MEMORY GRAPH +## ============================================== +def createMemoryGraph(benchmark, data): + x = map(lambda x: x[0], data["memory"]) + inMemory = map(lambda x: x[1], data["memory"]) # In-Memory Data + anticache = map(lambda x: x[2], data["memory"]) # Anti-Cache Data + y = np.row_stack((inMemory, anticache)) + + # this call to 'cumsum' (cumulative sum), passing in your y data, + # is necessary to avoid having to manually order the datasets + y_stack = np.cumsum(y, axis=0) + + # GRAPH + fig = plot.figure() + ax1 = fig.add_subplot(111) + + ax1.fill_between(x, 0, y_stack[0,:], + color=OPT_COLORS[0], + alpha=0.5, + label="XXX", + ) + ax1.fill_between(x, y_stack[0,:], y_stack[1,:], + color=OPT_COLORS[1], + alpha=0.5, + label="YYY", + ) + ax1.plot(x, map(lambda x: sum(x[1:]), data["memory"]), + color=OPT_COLORS[1], + linewidth=3, + label="Anti-Cache Data" + ) + ax1.plot(x, inMemory, + color=OPT_COLORS[0], + linewidth=3, + label="In-Memory Data", + ) + + # GRID + axes = ax1.get_axes() + axes.set_ylim(0, 1250) + axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5) + axes.set_axisbelow(True) + graphutil.makeGrid(ax1) + + # Y-AXIS + ax1.set_ylabel("Memory (MB)", name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE) + yLabels = map(lambda y: "%d" % (y / 1000), ax1.get_yticks()) + #ax1.set_yticklabels(yLabels) + ax1.yaxis.set_major_locator(MultipleLocator(250)) + ax1.minorticks_on() + for tick in ax1.yaxis.get_major_ticks(): + tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE) + tick.label.set_fontname(OPT_FONT_NAME) + + # X-AXIS + ax1.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE) + ax1.xaxis.set_major_locator(MaxNLocator(6)) + xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks()) + ax1.set_xticklabels(xLabels) + for tick in ax1.xaxis.get_major_ticks(): + tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE) + tick.label.set_fontname(OPT_FONT_NAME) + + # LEGEND + fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE) + ax1.legend(loc='upper left', shadow=OPT_LEGEND_SHADOW, prop=fp) + + # Evictions + if len(data["evictions"]) > 0: + # addEvictionLines(data["evictions"], y_max) + pass + else: + LOG.warn("Missing eviction history for '%s'" % benchmark) + + return (fig) +## DEF + +## ============================================== +## ADD EVICTION DEMARCATIONS +## ============================================== +def addEvictionLines(ax, evictions, height): + for x,duration in evictions: + #width = max(1, duration) + width = 1 + ax.vlines(x, 0, height, + color='black', + linewidth=width, + linestyles='dashed', + alpha=1.0, + ) + ## FOR +## DEF + +## ============================================== +## BOTH PLOTS IN ONE +## ============================================== + +def plotMemoryAndThroughput(benchmark, data): + x_max = max(data["x_values"]) + y_max = max(data["y_values"]) + + tmp = y_max + order = 1 + + while tmp > 10: + order = order * 10 + tmp = tmp / 10; + + y_max_range = math.ceil(tmp) * order + + x = map(lambda x: x[0], data["memory"]) + inMemory = map(lambda x: x[1], data["memory"]) # In-Memory Data + anticache = map(lambda x: x[2], data["memory"]) # Anti-Cache Data + y = np.row_stack((inMemory, anticache)) + + # this call to 'cumsum' (cumulative sum), passing in your y data, + # is necessary to avoid having to manually order the datasets + y_stack = np.cumsum(y, axis=0) + + + fig = plot.figure() + fig.set_figheight(10) + ax1=fig.add_subplot(2,1,1) + + # f, axarr = plot.subplots(2, sharex=True) + + + ax1.fill_between(x, 0, y_stack[0,:], + color=OPT_COLORS[0], + alpha=0.5, + label="XXX", + ) + ax1.fill_between(x, y_stack[0,:], y_stack[1,:], + color=OPT_COLORS[1], + alpha=0.5, + label="YYY", + ) + ax1.plot(x, map(lambda x: sum(x[1:]), data["memory"]), + color=OPT_COLORS[1], + linewidth=3, + label="Anti-Cache Data" + ) + ax1.plot(x, inMemory, + color=OPT_COLORS[0], + linewidth=3, + label="In-Memory Data", + ) + + # GRID + #mem_max = max((data["memory"])[1]) + print data["memory"] + mem_max = max(inMemory) + mem_max = mem_max + max(anticache) + print mem_max + tmp = mem_max + order = 1 + + #while tmp > 10: + # order = order * 10 + # tmp = tmp / 10; + # print tmp + + mem_max_range = mem_max + mem_max*0.30 + print mem_max_range + axes = ax1.get_axes() + axes.set_ylim(0, mem_max_range) + axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5) + axes.set_axisbelow(True) + graphutil.makeGrid(ax1) + + head = data["run_head"] + info = data["run_info"] + # generate title string + # 0 1 2 3 4 5 6 7 + # run benchmark tier partitions blocking_clients client_hosts client_threads scaling_factor + # 8 9 10 11 12 13 + # block_size blocks_evicted threshold_mb runtime merge skew + title_str="%s %s: %s %s %s %s: %s %s: %s" % (info[2], head[12], info[12], info[3], info[4], head[10], info[10], head[13], info[13]) + + # Y-AXIS + + ax1.set_title(title_str) + ax1.set_ylabel("Memory (MB)", name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE) + yLabels = map(lambda y: "%d" % (y / 1000), ax1.get_yticks()) + #ax1.set_yticklabels(yLabels) + ax1.yaxis.set_major_locator(MultipleLocator(250)) + ax1.minorticks_on() + for tick in ax1.yaxis.get_major_ticks(): + tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE) + tick.label.set_fontname(OPT_FONT_NAME) + + # X-AXIS + #ax1.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE) + ax1.xaxis.set_major_locator(MaxNLocator(6)) + xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks()) + ax1.set_xticklabels(xLabels) + for tick in ax1.xaxis.get_major_ticks(): + tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE) + tick.label.set_fontname(OPT_FONT_NAME) + + # LEGEND + fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE) + ax1.legend(loc='upper left', shadow=OPT_LEGEND_SHADOW, prop=fp) + + # Evictions + if len(data["evictions"]) > 0: + # addEvictionLines(data["evictions"], y_max) + pass + else: + LOG.warn("Missing eviction history for '%s'" % benchmark) + + ax2 = fig.add_subplot(2,1,2) + + # Throughout + ax2.plot(data["x_values"], data["y_values"], + color=OPT_COLORS[0], + linewidth=3.5, + marker='', + ) + + if len(data["evictions"]) > 0: + addEvictionLines(ax1, data["evictions"], mem_max_range) + #LOG.info("Adding eviction lines.") + pass + else: + LOG.warn("Missing eviction history for '%s'" % benchmark) + + axes = ax2.get_axes() + axes.set_ylim(0, y_max_range) + axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') + axes.set_axisbelow(True) + graphutil.makeGrid(ax2) + + ax2.set_ylabel(OPT_Y_LABEL_THROUGHPUT, name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE) + ax2.yaxis.set_major_locator(MaxNLocator(5)) + ax2.minorticks_on() + for tick in ax2.yaxis.get_major_ticks(): + tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE) + tick.label.set_fontname(OPT_FONT_NAME) + + # X-AXIS + ax2.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE) + ax2.set_xlim(0, x_max) + ax2.xaxis.set_major_locator(MaxNLocator(6)) + xLabels = map(lambda x: "%d" % (x / 1000), ax2.get_xticks()) + ax2.set_xticklabels(xLabels) + for tick in ax2.xaxis.get_major_ticks(): + tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE) + tick.label.set_fontname(OPT_FONT_NAME) + + plot.tight_layout() + return fig +## DEF + + + + +## ============================================== +## main +## ============================================== +if __name__ == '__main__': + + OPT_FONT_NAME = 'DejaVu Sans' + OPT_LABEL_WEIGHT = 'bold' + OPT_MARKER_SIZE = 6.0 + OPT_DATA_EVICTIONS = "/home/user/giardino/data-hstore/articles/articles-nvm/k0.05" + + ## ---------------------------------------------- + ## LOAD DATA + ## ---------------------------------------------- + processedData = { } + for file in glob.glob(os.path.join(OPT_DATA_EVICTIONS, "*-evictions.csv")): + print file + m = re.search(r'([\w\-\.]+)-evictions.csv', file) + assert m + print m.group(1) + benchmark = m.group(1) + + # Check to see whether we have a throughput+memory files for this benchmark + throughputFile = os.path.join(OPT_DATA_EVICTIONS, "%s-results.csv" % benchmark) + if not os.path.exists(throughputFile): + LOG.warn("Missing throughput file '%s'" % throughputFile) + continue + memoryFile = os.path.join(OPT_DATA_EVICTIONS, "%s-memory.csv" % benchmark) + if not os.path.exists(memoryFile): + LOG.warn("Missing memory file '%s'" % memoryFile) + #continue + + data = { + "x_values": [ ], + "y_values": [ ], + "timestamps": [ ], + "memory": [ ], + "evictions": [ ], + "run_head": [ ], + "run_info": [ ], + } + + + data["run_head"] = ["run", "benchmark", "tier", "partitions", "blocking_clients", + "client_hosts", "client_threads", "scaling_factor", "block_size", "blocks_evicted", + "threshold_mb", "runtime", "merge", "skew"] + data["run_info"] = benchmark.split('-') + + i = 0 + for s in data["run_info"]: + if i < 4: + if i == 2: + i += 1 + pass + i += 1 + continue + elif i <= len(data["run_info"]) - 2: + pass + else: + data["run_info"][i] = s.translate(None, string.ascii_letters) + i += 1 + + ## LOAD THROUGHPUT DATA + with open(throughputFile, "U") as f: + reader = csv.reader(f) + col_xref = None + first = True + for row in reader: + if col_xref is None: + col_xref = { } + for i in xrange(len(row)): + col_xref[row[i]] = i + continue + if first: + first = False + data["x_values"].append(0) + data["y_values"].append(float(row[col_xref['THROUGHPUT']])) + data["timestamps"].append(int(row[col_xref['TIMESTAMP']])) + + data["x_values"].append(int(row[col_xref['ELAPSED']])) + data["y_values"].append(float(row[col_xref['THROUGHPUT']])) + data["timestamps"].append(int(row[col_xref['TIMESTAMP']])) + ## FOR + ## WITH + + if os.path.exists(memoryFile): + ## LOAD MEMORY DATA + with open(memoryFile, "U") as f: + reader = csv.reader(f) + col_xref = None + memoryData = [ ] + for row in reader: + if col_xref is None: + col_xref = { } + for i in xrange(len(row)): + col_xref[row[i]] = i + continue + timestamp = int(row[col_xref['ELAPSED']]) + memorySize = 0 + anticacheSize = 0 + for col in ['TUPLE_DATA_MEMORY', 'STRING_MEMORY']:#, 'INDEX_MEMORY']: + #for col in ['STRING_MEMORY']: + memorySize += long(row[col_xref[col]]) + for col in ['ANTICACHE_BYTES_EVICTED']: + anticacheSize += long(row[col_xref[col]]) +# for col in ['TUPLE_COUNT']: +# #for col in ['STRING_MEMORY']: +# memorySize += long(row[col_xref[col]]) +# for col in ['ANTICACHE_TUPLES_EVICTED']: +# anticacheSize += long(row[col_xref[col]]) + print(memorySize, anticacheSize) + memoryData.append((timestamp, memorySize / 1000, anticacheSize / 1000)) + ## FOR + + # Repeat the first entry so that we have flushed lines + memoryData.insert(0, tuple([0] + list(memoryData[0][1:]))) + for i in xrange(len(memoryData)): + if memoryData[i][1] == 0: continue + for j in xrange(0, i): + assert memoryData[j][1] == 0, "%d -> %s" % (j, memoryData[j]) + memoryData[j] = tuple([memoryData[j][0]] + list(memoryData[i][1:])) + break + ## FOR + memoryData.append(tuple([data["x_values"][-1]] + list(memoryData[-1][1:]))) + + # Sort this mofo + data["memory"] = sorted(memoryData, key=lambda x: x[0]) + ## WITH + + ## LOAD EVICTION DATA + with open(file, "U") as f: + reader = csv.reader(f) + col_xref = None + evictions = [ ] + globalStart = min(data["timestamps"]) + LOG.info(globalStart) + for row in reader: + if col_xref is None: + col_xref = { } + for i in xrange(len(row)): + col_xref[row[i]] = i + continue + start = int(row[col_xref['START']]) + duration = int(row[col_xref['STOP']]) - start + assert duration >= 0 + if start < globalStart: + continue + evictions.append((start-globalStart, duration)) + ## FOR + data["evictions"] = sorted(evictions, key=lambda x: x[0]) + ## WITH + + processedData[benchmark] = data + ## FOR + + ## ---------------------------------------------- + ## GENERATE GRAPHS + ## ---------------------------------------------- + for benchmark,data in processedData.iteritems(): +# fig1 = createThroughputGraph(benchmark, data) +# fig1.savefig("/home/michaelg/data-hstore/plots/ycsb-bugfinder/png/ycsb-throughput-%s-600s.png" % benchmark) +# graphutil.saveGraph(fig, "/home/michaelg/data-hstore/plots/ycsb-bugfinder/ycsb-throughput-%s.pdf" % benchmark, height=OPT_GRAPH_HEIGHT) + +# fig2 = createMemoryGraph(benchmark, data) +# fig2.savefig("/home/michaelg/data-hstore/plots/ycsb-bugfinder/png/ycsb-memory-%s-600s.png" % benchmark) +# graphutil.saveGraph(fig, "/home/michaelg/data-hstore/plots/ycsb-bugfinder/ycsb-memory-%s.pdf" % benchmark, height=OPT_GRAPH_HEIGHT) + fig3 = plotMemoryAndThroughput(benchmark, data) + print "making figure for %s" % benchmark + fig3.savefig("/home/user/giardino/data-hstore/plots/articles/png/articles-comb-%s.png" % benchmark) + + ## FOR + +## MAIN diff --git a/graphs/evictions-timeline-voter.py b/graphs/evictions-timeline-voter.py index 5202d44bf0..bc75ab0678 100755 --- a/graphs/evictions-timeline-voter.py +++ b/graphs/evictions-timeline-voter.py @@ -277,16 +277,10 @@ def plotMemoryAndThroughput(benchmark, data): ) # GRID - mem_max = max(data["memory"]) - print mem_max - tmp = mem_max - order = 1 + mem_max = max(inMemory) + mem_max_range = mem_max + max(anticache) + print mem_max_range - while tmp > 10: - order = order * 10 - tmp = tmp / 10; - - mem_max_range = math.ceil(tmp) * order axes = ax1.get_axes() axes.set_ylim(0, mem_max_range) axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5) @@ -295,9 +289,16 @@ def plotMemoryAndThroughput(benchmark, data): head = data["run_head"] info = data["run_info"] + print head + print info # generate title string # blocking 2, backing 3, skew 4, clients 6, blocksize 10 - title_str="%s %s %s: %s %s: %s %s: %skb" % (info[2], info[3], head[4], info[4], head[6], info[6], head[10], info[10]) + # generate title string + # 0 1 2 3 4 5 6 7 + # run benchmark tier partitions blocking_clients client_hosts client_threads scaling_factor + # 8 9 10 11 12 + # block_size blocks_evicted threshold_mb runtime merge + title_str="%s %s %s %s: %s" % (info[2], info[3], info[4], head[10], info[10]) # Y-AXIS @@ -419,22 +420,20 @@ def plotMemoryAndThroughput(benchmark, data): } - data["run_head"] = ["run", "benchmark", "blocking", "backing", "skew", "partitions", "blocking_clients", + data["run_head"] = ["run", "benchmark", "tier", "partitions", "blocking_clients", "client_hosts", "client_threads", "scaling_factor", "block_size", "blocks_evicted", - "threshold_mb", "runtime","merge"] + "threshold_mb", "runtime", "merge"] data["run_info"] = benchmark.split('-') i = 0 for s in data["run_info"]: if i < 4: if i == 2: - if s == "sync": - data["run_info"][i] = "sync merge" - else: - data["run_info"][i] = "abort reissue" + i += 1 + pass i += 1 continue - elif i == len(data["run_info"]) - 1: + elif i <= len(data["run_info"]) - 1: pass else: data["run_info"][i] = s.translate(None, string.ascii_letters) diff --git a/graphs/evictions-timeline-ycsb.py b/graphs/evictions-timeline-ycsb.py index 1e7aff3ead..191fd3ce7e 100755 --- a/graphs/evictions-timeline-ycsb.py +++ b/graphs/evictions-timeline-ycsb.py @@ -14,6 +14,8 @@ import glob import re import logging +import matplotlib +matplotlib.use('Agg') import matplotlib.pyplot as plot import pylab import numpy as np @@ -283,8 +285,13 @@ def plotMemoryAndThroughput(benchmark, data): head = data["run_head"] info = data["run_info"] # generate title string - # blocking 2, backing 3, skew 4, clients 6, blocksize 10 - title_str="%s %s %s: %s %s: %s %s: %skb" % (info[2], info[3], head[4], info[4], head[6], info[6], head[10], info[10]) + # run benchmark blocking backing skew partitions blocking_clients + # 0 1 2 3 4 5 6 + # client_hosts client_threads scaling_factor block_size blocks_evicted + # 7 8 9 10 11 + # threshold_mb runtime merge + # 12 13 14 + title_str="%s %s %s: %s %s: %s" % (info[2], info[14], head[4], info[4], head[6], info[6]) # Y-AXIS ax1.set_title(title_str) @@ -371,7 +378,7 @@ def plotMemoryAndThroughput(benchmark, data): OPT_FONT_NAME = 'DejaVu Sans' OPT_LABEL_WEIGHT = 'bold' OPT_MARKER_SIZE = 6.0 - OPT_DATA_EVICTIONS = "/home/michaelg/data-hstore/ycsb/ycsb-bugfinder" + OPT_DATA_EVICTIONS = "/home/user/giardino/data-hstore/ycsb/ycsb-nvm/1run" ## ---------------------------------------------- ## LOAD DATA @@ -415,9 +422,9 @@ def plotMemoryAndThroughput(benchmark, data): if i < 4: if i == 2: if s == "sync": - data["run_info"][i] = "sync merge" + data["run_info"][i] = "sync" else: - data["run_info"][i] = "abort reissue" + data["run_info"][i] = "abrt" i += 1 continue elif i == len(data["run_info"]) - 1: @@ -532,7 +539,7 @@ def plotMemoryAndThroughput(benchmark, data): # graphutil.saveGraph(fig, "/home/michaelg/data-hstore/plots/ycsb-bugfinder/ycsb-memory-%s.pdf" % benchmark, height=OPT_GRAPH_HEIGHT) fig3 = plotMemoryAndThroughput(benchmark, data) print "making figure for %s" % benchmark - fig3.savefig("/home/michaelg/data-hstore/plots/ycsb-bugfinder/png/ycsb-comb-%s.png" % benchmark) + fig3.savefig("/home/user/giardino/data-hstore/plots/ycsb/ycsb-nvm/png/ycsb-comb-%s.png" % benchmark) ## FOR diff --git a/scripts/multitier/articles-multitier.sh b/scripts/multitier/articles-multitier.sh new file mode 100755 index 0000000000..dc67475d97 --- /dev/null +++ b/scripts/multitier/articles-multitier.sh @@ -0,0 +1,259 @@ +#!/bin/bash + +#UtilityWorkMessage --------------------------------------------------------------------- + +trap onexit 1 2 3 15 +function onexit() { + local exit_status=${1:-$?} + pkill -f hstore.tag + exit $exit_status +} + +# --------------------------------------------------------------------- + +ENABLE_ANTICACHE=true + +#SITE_HOST="dev3.db.pdl.cmu.local" +SITE_HOST="localhost" + +CLIENT_HOSTS=( "localhost") + +#CLIENT_HOSTS=( \ +# "localhost" \ +# "localhost" \ +# "localhost" \ +# "localhost" \ +# ) +N_HOSTS=1 +BASE_CLIENT_THREADS=1 +CLIENT_THREADS_PER_HOST=4 +#BASE_SITE_MEMORY=8192 +#BASE_SITE_MEMORY_PER_PARTITION=1024 +BASE_SITE_MEMORY=8192 +BASE_SITE_MEMORY_PER_PARTITION=512 +BASE_PROJECT="articles" +BASE_DIR=`pwd` +OUTPUT_DIR="/home/user/giardino/data-hstore/articles" +#BLK_CON=1 +BLK_EVICT=400 +AC_THRESH=500 +SCALE=10 +BLOCK_SIZE_KB=256 +DURATION_S=600 +WARMUP_S=10 +INTERVAL_S=10 +PARTITIONS=1 + +for BLK_CON in 1 10 50 ; do +for BLOCK_SIZE in 256; do +for BLOCKING in 'true'; do +for BLOCK_MERGE in 'true' 'false'; do + for DB in 'NVM' ; do + for round in 1; do + if [ "$BLOCKING" = "true" ]; then + block='sync' + else + block='abrt' + fi + if [ "$BLOCK_MERGE" = "true" ]; then + block_merge='block' + else + block_merge='tuple' + fi + BLOCK_SIZE_KB=$BLOCK_SIZE + #BLK_EVICT=$((51200 / $BLOCK_SIZE_KB)) + OUTPUT_PREFIX="$OUTPUT_DIR/articles-nvm/$round-articles-2_tier_sync-${PARTITIONS}p-${BLK_CON}c-${N_HOSTS}h-${CLIENT_THREADS_PER_HOST}ct-sc$SCALE-${BLOCK_SIZE_KB}kb-${BLK_EVICT}b-${AC_THRESH}th-${DURATION_S}s-${block_merge}-0.05k" + LOG_PREFIX="/home/user/giardino/h-store/logs/articles-nvm/$round-articles-2_tier_sync-${PARTITIONS}p-${BLK_CON}c-${N_HOSTS}h-${CLIENT_THREADS_PER_HOST}ct-sc$SCALE-${BLOCK_SIZE_KB}kb-${BLK_EVICT}b-${AC_THRESH}th-${DURATION_S}s-${block_merge}-0.05k" + echo "log = $LOG_PREFIX" + echo $OUTPUT_PREFIX + +#ANTICACHE_BLOCK_SIZE=65536 + +#ANTICACHE_BLOCK_SIZE=262144 + ANTICACHE_BLOCK_SIZE=$(($BLOCK_SIZE_KB * 1024)) + ANTICACHE_THRESHOLD=.5 + DURATION=$((${DURATION_S} * 1000)) + WARMUP=$((${WARMUP_S} * 1000)) + INTERVAL=$((${INTERVAL_S} * 1000)) + + BASE_ARGS=( \ +# SITE DEBUG + "-Dsite.status_enable=false" \ + "-Dsite.status_interval=10000" \ +# "-Dsite.status_exec_info=true" \ +# "-Dsite.status_check_for_zombies=true" \ +# "-Dsite.exec_profiling=true" \ +# "-Dsite.profiling=true" \ +# "-Dsite.txn_counters=true" \ +# "-Dsite.pool_profiling=true" \ +# "-Dsite.network_profiling=false" \ +# "-Dsite.log_backup=true"\ +# "-Dnoshutdown=true" \ + +# Site Params + "-Dsite.jvm_asserts=false" \ + "-Dsite.specexec_enable=false" \ + "-Dsite.cpu_affinity_one_partition_per_core=true" \ +#"-Dsite.cpu_partition_blacklist=0,2,4,6,8,10,12,14,16,18" \ +#"-Dsite.cpu_utility_blacklist=0,2,4,6,8,10,12,14,16,18" \ +# "-Dsite.network_incoming_limit_txns=50000" \ +# "-Dsite.commandlog_enable=false" \ +# "-Dsite.txn_incoming_delay=5" \ +# "-Dsite.exec_postprocessing_threads=false" \ + "-Dsite.anticache_eviction_distribution=even" \ + "-Dsite.log_dir=$LOG_PREFIX" \ + "-Dsite.specexec_enable=false" \ + +# "-Dsite.queue_allow_decrease=true" \ +# "-Dsite.queue_allow_increase=true" \ +# "-Dsite.queue_threshold_factor=0.5" \ + +# Client Params + "-Dclient.scalefactor=${SCALE}" \ + "-Dclient.memory=2048" \ + "-Dclient.txnrate=2000" \ + "-Dclient.warmup=${WARMUP}" \ + "-Dclient.duration=${DURATION}" \ + "-Dclient.interval=${INTERVAL}" \ + "-Dclient.shared_connection=false" \ + "-Dclient.blocking=true" \ + "-Dclient.blocking_concurrent=${BLK_CON}" \ + "-Dclient.throttle_backoff=100" \ + "-Dclient.output_anticache_evictions=${OUTPUT_PREFIX}-evictions.csv" \ + "-Dclient.output_anticache_profiling=${OUTPUT_PREFIX}-acprofiling.csv" \ +# "-Dclient.output_anticache_access=${OUTPUT_PREFIX}-accesses.csv" \ + "-Dclient.output_memory_stats=${OUTPUT_PREFIX}-memory.csv" \ +# "-Dclient.weights=\"ReadRecord:50,UpdateRecord:50,*:0\"" \ + +# Anti-Caching Experiments + "-Dsite.anticache_enable=${ENABLE_ANTICACHE}" \ + "-Dsite.anticache_enable_multilevel=true" \ + "-Dsite.anticache_timestamps=${ENABLE_TIMESTAMPS}" \ +# "-Dsite.anticache_batching=true" \ + "-Dsite.anticache_profiling=true" \ + "-Dsite.anticache_reset=false" \ + "-Dsite.anticache_block_size=${ANTICACHE_BLOCK_SIZE}" \ + "-Dsite.anticache_check_interval=30000" \ + "-Dsite.anticache_threshold_mb=${AC_THRESH}" \ + "-Dsite.anticache_blocks_per_eviction=${BLK_EVICT}" \ + "-Dsite.anticache_max_evicted_blocks=1000000" \ +# "-Dsite.anticache_dbsize=1540M" \ +# "-Dsite.anticache_db_blocks=$BLOCKING" \ +# "-Dsite.anticache_block_merge=$BLOCK_MERGE" \ +# "-Dsite.anticache_dbtype=$DB" \ +# "-Dsite.anticache_evict_size=${ANTICACHE_EVICT_SIZE}" \ + "-Dsite.anticache_dir=/mnt/pmfs/aclevel0" \ + "-Dsite.anticache_levels=NVM,true,256K,2G;BERKELEY,false,256K,16G" \ + "-Dsite.anticache_multilevel_dirs=/mnt/pmfs/nvm-level0;/tmp/berk-level1" \ + "-Dsite.anticache_threshold=${ANTICACHE_THRESHOLD}" \ + "-Dclient.anticache_enable=false" \ + "-Dclient.anticache_evict_interval=5000" \ + "-Dclient.anticache_evict_size=${ANTICACHE_BLOCK_SIZE}" \ + "-Dclient.output_csv=${OUTPUT_PREFIX}-results.csv" \ + +# CLIENT DEBUG + "-Dclient.output_txn_counters=${OUTPUT_PREFIX}-txncounters.csv" \ + "-Dclient.output_clients=false" \ + "-Dclient.profiling=false" \ + "-Dclient.output_response_status=false" \ +# "-Dclient.output_queue_profiling=${OUTPUT_PREFIX}-queue.csv" \ +# "-Dclient.output_basepartitions=true" \ +#"-Dclient.jvm_args=\"-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-TraceClassUnloading\"" + ) + + EVICTABLE_TABLES=( \ + "ARTICLES" \ + "COMMENTS" \ + ) + BATCHEVICTABLE_TABLES=( \ + "ARTICLES" \ + "COMMENTS" \ + ) + EVICTABLES="" + BATCHEVICTABLES="" + if [ "$ENABLE_ANTICACHE" = "true" ]; then + for t in ${EVICTABLE_TABLES[@]}; do + EVICTABLES="${t},${EVICTABLES}" + done + for t in ${BATCHEVICTABLE_TABLES[@]}; do + BATCHEVICTABLES="${t},${BATCHEVICTABLES}" + done + fi + +# Compile + HOSTS_TO_UPDATE=("$SITE_HOST") + for CLIENT_HOST in ${CLIENT_HOSTS[@]}; do + NEED_UPDATE=1 + for x in ${HOSTS_TO_UPDATE[@]}; do + if [ "$CLIENT_HOST" = "$x" ]; then + NEED_UPDATE=0 + break + fi + done + if [ $NEED_UPDATE = 1 ]; then + HOSTS_TO_UPDATE+=("$CLIENT_HOST") + fi + done +#for HOST in ${HOSTS_TO_UPDATE[@]}; do +#ssh $HOST "cd $BASE_DIR && git pull && ant compile" & +#done + wait + + ant compile +#HSTORE_HOSTS="${SITE_HOST}:0:0-7" + if [ "$PARTITIONS" = "1" ]; then + HSTORE_HOSTS="${SITE_HOST}:0:0" + else + PART_NO=$((${PARTITIONS} - 1)) + HSTORE_HOSTS="${SITE_HOST}:0:0-$PART_NO" + fi + echo "$HSTORE_HOSTS" + + NUM_CLIENTS=$((${PARTITIONS} * ${BASE_CLIENT_THREADS})) + SITE_MEMORY=`expr $BASE_SITE_MEMORY + \( $PARTITIONS \* $BASE_SITE_MEMORY_PER_PARTITION \)` + +# BUILD PROJECT JAR + ant hstore-prepare \ + -Dproject=${BASE_PROJECT} \ + -Dhosts=${HSTORE_HOSTS} \ + -Devictable=${EVICTABLES} + test -f ${BASE_PROJECT}.jar || exit -1 + +# UPDATE CLIENTS + CLIENT_COUNT=0 + CLIENT_HOSTS_STR="" + for CLIENT_HOST in ${CLIENT_HOSTS[@]}; do + CLIENT_COUNT=`expr $CLIENT_COUNT + 1` + if [ ! -z "$CLIENT_HOSTS_STR" ]; then + CLIENT_HOSTS_STR="${CLIENT_HOSTS_STR}", + fi + CLIENT_HOSTS_STR="${CLIENT_HOSTS_STR}${CLIENT_HOST}" + done + +# DISTRIBUTE PROJECT JAR + for HOST in ${HOSTS_TO_UPDATE[@]}; do + if [ "$HOST" != $(hostname) ]; then + scp -r ${BASE_PROJECT}.jar ${HOST}:${BASE_DIR} & + fi + done + wait + + echo "Client count $CLIENT_COUNT client hosts: $CLIENT_HOSTS_STR" +# EXECUTE BENCHMARK + ant hstore-benchmark ${BASE_ARGS[@]} \ + -Dproject=${BASE_PROJECT} \ + -Dkillonzero=false \ + -Dclient.threads_per_host=${NUM_CLIENTS} \ + -Dsite.memory=${SITE_MEMORY} \ + -Dclient.hosts=${CLIENT_HOSTS_STR} \ + -Dclient.count=${CLIENT_COUNT} + result=$? + if [ $result != 0 ]; then + exit $result + fi + done + done +done +done +done #BLOCK_SIZE +done #BLK_CON diff --git a/scripts/multitier/voter-multitier.sh b/scripts/multitier/voter-multitier.sh new file mode 100755 index 0000000000..d6e24aef9d --- /dev/null +++ b/scripts/multitier/voter-multitier.sh @@ -0,0 +1,254 @@ +#!/bin/bash + +#UtilityWorkMessage --------------------------------------------------------------------- + +trap onexit 1 2 3 15 +function onexit() { + local exit_status=${1:-$?} + pkill -f hstore.tag + exit $exit_status +} + +# --------------------------------------------------------------------- + +ENABLE_ANTICACHE=true + +#SITE_HOST="dev3.db.pdl.cmu.local" +SITE_HOST="localhost" + +#CLIENT_HOSTS=( "localhost") + +CLIENT_HOSTS=( \ + "localhost" \ + "localhost" \ + "localhost" \ + "localhost" \ + ) +N_HOSTS=4 +BASE_CLIENT_THREADS=1 +CLIENT_THREADS_PER_HOST=4 +#BASE_SITE_MEMORY=8192 +#BASE_SITE_MEMORY_PER_PARTITION=1024 +BASE_SITE_MEMORY=2048 +BASE_SITE_MEMORY_PER_PARTITION=1024 +BASE_PROJECT="voter" +BASE_DIR=`pwd` +OUTPUT_DIR="/home/user/giardino/data-hstore/voter" +#BLK_CON=1 +BLK_EVICT=400 +AC_THRESH=128 +SCALE=100 +BLOCK_SIZE_KB=256 +DURATION_S=300 +WARMUP_S=10 +INTERVAL_S=10 +PARTITIONS=8 + +for BLK_CON in 100 ; do +for BLOCK_SIZE in 256; do +for BLOCKING in 'false'; do +for BLOCK_MERGE in 'true'; do + for DB in 'NVM' ; do + for round in 1; do + if [ "$BLOCKING" = "true" ]; then + block='sync' + else + block='abrt' + fi + if [ "$BLOCK_MERGE" = "true" ]; then + block_merge='block' + else + block_merge='tuple' + fi + BLOCK_SIZE_KB=$BLOCK_SIZE + #BLK_EVICT=$((51200 / $BLOCK_SIZE_KB)) + OUTPUT_PREFIX="$OUTPUT_DIR/voter-nvm/$round-voter2-tier-${PARTITIONS}p-${BLK_CON}c-${N_HOSTS}h-${CLIENT_THREADS_PER_HOST}ct-sc$SCALE-${BLOCK_SIZE_KB}kb-${BLK_EVICT}b-${AC_THRESH}th-${DURATION_S}s-${block_merge}" + LOG_PREFIX="/home/user/giardino/h-store/logs/voter-nvm/$round-voter-2-tier-${PARTITIONS}p-${BLK_CON}c-${N_HOSTS}h-${CLIENT_THREADS_PER_HOST}ct-sc$SCALE-${BLOCK_SIZE_KB}kb-${BLK_EVICT}b-${AC_THRESH}th-${DURATION_S}s-${block_merge}" + echo "log = $LOG_PREFIX" + echo $OUTPUT_PREFIX + +#ANTICACHE_BLOCK_SIZE=65536 + +#ANTICACHE_BLOCK_SIZE=262144 + ANTICACHE_BLOCK_SIZE=$(($BLOCK_SIZE_KB * 1024)) + ANTICACHE_THRESHOLD=.5 + DURATION=$((${DURATION_S} * 1000)) + WARMUP=$((${WARMUP_S} * 1000)) + INTERVAL=$((${INTERVAL_S} * 1000)) + + BASE_ARGS=( \ +# SITE DEBUG + "-Dsite.status_enable=false" \ + "-Dsite.status_interval=10000" \ +# "-Dsite.status_exec_info=true" \ +# "-Dsite.status_check_for_zombies=true" \ +# "-Dsite.exec_profiling=true" \ +# "-Dsite.profiling=true" \ +# "-Dsite.txn_counters=true" \ +# "-Dsite.pool_profiling=true" \ +# "-Dsite.network_profiling=false" \ +# "-Dsite.log_backup=true"\ +# "-Dnoshutdown=true" \ + +# Site Params + "-Dsite.jvm_asserts=false" \ + "-Dsite.specexec_enable=false" \ + "-Dsite.cpu_affinity_one_partition_per_core=true" \ +#"-Dsite.cpu_partition_blacklist=0,2,4,6,8,10,12,14,16,18" \ +#"-Dsite.cpu_utility_blacklist=0,2,4,6,8,10,12,14,16,18" \ +# "-Dsite.network_incoming_limit_txns=50000" \ +# "-Dsite.commandlog_enable=false" \ +# "-Dsite.txn_incoming_delay=5" \ +# "-Dsite.exec_postprocessing_threads=false" \ + "-Dsite.anticache_eviction_distribution=even" \ + "-Dsite.log_dir=$LOG_PREFIX" \ + "-Dsite.specexec_enable=false" \ + +# "-Dsite.queue_allow_decrease=true" \ +# "-Dsite.queue_allow_increase=true" \ +# "-Dsite.queue_threshold_factor=0.5" \ + +# Client Params + "-Dclient.scalefactor=${SCALE}" \ + "-Dclient.memory=2048" \ + "-Dclient.txnrate=4000" \ + "-Dclient.warmup=${WARMUP}" \ + "-Dclient.duration=${DURATION}" \ + "-Dclient.interval=${INTERVAL}" \ + "-Dclient.shared_connection=false" \ + "-Dclient.blocking=true" \ + "-Dclient.blocking_concurrent=${BLK_CON}" \ + "-Dclient.throttle_backoff=100" \ + "-Dclient.output_anticache_evictions=${OUTPUT_PREFIX}-evictions.csv" \ + "-Dclient.output_anticache_profiling=${OUTPUT_PREFIX}-acprofiling.csv" \ +# "-Dclient.output_anticache_access=${OUTPUT_PREFIX}-accesses.csv" \ + "-Dclient.output_memory_stats=${OUTPUT_PREFIX}-memory.csv" \ +# "-Dclient.weights=\"ReadRecord:50,UpdateRecord:50,*:0\"" \ + +# Anti-Caching Experiments + "-Dsite.anticache_enable=${ENABLE_ANTICACHE}" \ + "-Dsite.anticache_enable_multilevel=true" \ + "-Dsite.anticache_timestamps=${ENABLE_TIMESTAMPS}" \ +# "-Dsite.anticache_batching=true" \ + "-Dsite.anticache_profiling=true" \ + "-Dsite.anticache_reset=false" \ + "-Dsite.anticache_block_size=${ANTICACHE_BLOCK_SIZE}" \ + "-Dsite.anticache_check_interval=10000" \ + "-Dsite.anticache_threshold_mb=${AC_THRESH}" \ + "-Dsite.anticache_blocks_per_eviction=${BLK_EVICT}" \ + "-Dsite.anticache_max_evicted_blocks=1000000" \ +# "-Dsite.anticache_dbsize=1540M" \ +# "-Dsite.anticache_db_blocks=$BLOCKING" \ +# "-Dsite.anticache_block_merge=$BLOCK_MERGE" \ +# "-Dsite.anticache_dbtype=$DB" \ +# "-Dsite.anticache_evict_size=${ANTICACHE_EVICT_SIZE}" \ + "-Dsite.anticache_dir=/mnt/pmfs/aclevel0" \ + "-Dsite.anticache_levels=NVM,false,256K,1G;BERKELEY,false,256K,16G" \ + "-Dsite.anticache_multilevel_dirs=/mnt/pmfs/nvm-level0;/tmp/berk-level1" \ + "-Dsite.anticache_threshold=${ANTICACHE_THRESHOLD}" \ + "-Dclient.anticache_enable=false" \ + "-Dclient.anticache_evict_interval=5000" \ + "-Dclient.anticache_evict_size=${ANTICACHE_BLOCK_SIZE}" \ + "-Dclient.output_csv=${OUTPUT_PREFIX}-results.csv" \ + +# CLIENT DEBUG + "-Dclient.output_txn_counters=${OUTPUT_PREFIX}-txncounters.csv" \ + "-Dclient.output_clients=false" \ + "-Dclient.profiling=false" \ + "-Dclient.output_response_status=false" \ +# "-Dclient.output_queue_profiling=${OUTPUT_PREFIX}-queue.csv" \ +# "-Dclient.output_basepartitions=true" \ +#"-Dclient.jvm_args=\"-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-TraceClassUnloading\"" + ) + + EVICTABLE_TABLES=( \ + "votes" \ + ) + EVICTABLES="" + BATCHEVICTABLES="" + if [ "$ENABLE_ANTICACHE" = "true" ]; then + for t in ${EVICTABLE_TABLES[@]}; do + EVICTABLES="${t},${EVICTABLES}" + done + for t in ${BATCHEVICTABLE_TABLES[@]}; do + BATCHEVICTABLES="${t},${BATCHEVICTABLES}" + done + fi + +# Compile + HOSTS_TO_UPDATE=("$SITE_HOST") + for CLIENT_HOST in ${CLIENT_HOSTS[@]}; do + NEED_UPDATE=1 + for x in ${HOSTS_TO_UPDATE[@]}; do + if [ "$CLIENT_HOST" = "$x" ]; then + NEED_UPDATE=0 + break + fi + done + if [ $NEED_UPDATE = 1 ]; then + HOSTS_TO_UPDATE+=("$CLIENT_HOST") + fi + done +#for HOST in ${HOSTS_TO_UPDATE[@]}; do +#ssh $HOST "cd $BASE_DIR && git pull && ant compile" & +#done + wait + + ant compile +#HSTORE_HOSTS="${SITE_HOST}:0:0-7" + if [ "$PARTITIONS" = "1" ]; then + HSTORE_HOSTS="${SITE_HOST}:0:0" + else + PART_NO=$((${PARTITIONS} - 1)) + HSTORE_HOSTS="${SITE_HOST}:0:0-$PART_NO" + fi + echo "$HSTORE_HOSTS" + + NUM_CLIENTS=$((${PARTITIONS} * ${BASE_CLIENT_THREADS})) + SITE_MEMORY=`expr $BASE_SITE_MEMORY + \( $PARTITIONS \* $BASE_SITE_MEMORY_PER_PARTITION \)` + +# BUILD PROJECT JAR + ant hstore-prepare \ + -Dproject=${BASE_PROJECT} \ + -Dhosts=${HSTORE_HOSTS} \ + -Devictable=${EVICTABLES} + test -f ${BASE_PROJECT}.jar || exit -1 + +# UPDATE CLIENTS + CLIENT_COUNT=0 + CLIENT_HOSTS_STR="" + for CLIENT_HOST in ${CLIENT_HOSTS[@]}; do + CLIENT_COUNT=`expr $CLIENT_COUNT + 1` + if [ ! -z "$CLIENT_HOSTS_STR" ]; then + CLIENT_HOSTS_STR="${CLIENT_HOSTS_STR}", + fi + CLIENT_HOSTS_STR="${CLIENT_HOSTS_STR}${CLIENT_HOST}" + done + +# DISTRIBUTE PROJECT JAR + for HOST in ${HOSTS_TO_UPDATE[@]}; do + if [ "$HOST" != $(hostname) ]; then + scp -r ${BASE_PROJECT}.jar ${HOST}:${BASE_DIR} & + fi + done + wait + + echo "Client count $CLIENT_COUNT client hosts: $CLIENT_HOSTS_STR" +# EXECUTE BENCHMARK + ant hstore-benchmark ${BASE_ARGS[@]} \ + -Dproject=${BASE_PROJECT} \ + -Dkillonzero=false \ + -Dclient.threads_per_host=${NUM_CLIENTS} \ + -Dsite.memory=${SITE_MEMORY} \ + -Dclient.hosts=${CLIENT_HOSTS_STR} \ + -Dclient.count=${CLIENT_COUNT} + result=$? + if [ $result != 0 ]; then + exit $result + fi + done + done +done +done +done #BLOCK_SIZE +done #BLK_CON diff --git a/scripts/multitier/ycsb-old.sh b/scripts/multitier/ycsb-old.sh new file mode 100755 index 0000000000..d4217f5d0a --- /dev/null +++ b/scripts/multitier/ycsb-old.sh @@ -0,0 +1,212 @@ +#!/bin/bash + +#UtilityWorkMessage --------------------------------------------------------------------- + +trap onexit 1 2 3 15 +function onexit() { +local exit_status=${1:-$?} +pkill -f hstore.tag +exit $exit_status +} + +# --------------------------------------------------------------------- + +ENABLE_ANTICACHE=true + +#SITE_HOST="dev3.db.pdl.cmu.local" +SITE_HOST="localhost" + +CLIENT_HOSTS=( \ + "localhost" \ + "localhost" \ + "localhost" \ + "localhost" \ + ) +# "dev1.db.pdl.cmu.local" \ +# "dev1.db.pdl.cmu.local" \ +# "dev1.db.pdl.cmu.local" \ +# "dev1.db.pdl.cmu.local" \ + +BASE_CLIENT_THREADS=1 +#BASE_SITE_MEMORY=8192 +#BASE_SITE_MEMORY_PER_PARTITION=1024 +BASE_SITE_MEMORY=8192 +BASE_SITE_MEMORY_PER_PARTITION=1024 +BASE_PROJECT="ycsb" +BASE_DIR=`pwd` +OUTPUT_DIR="/home/michaelg/data-hstore/ycsb" + +for BLOCKING in 'false' 'true'; do + for DB in 'BERKELEY' 'NVM'; do + for skew in 0.8 1.01 1.1 1.2; do + for round in 1; do + if [ "$BLOCKING" = "true" ]; then + block='blocking' + else + block='nonblocking' + fi + OUTPUT_PREFIX="$OUTPUT_DIR/ycsb-hievict/$round-ycsb-hievict-$block-$DB-S$skew" + LOG_PREFIX="logs/test/ycsb-hievict/$round-ycsb-hievict-$block-$DB-S$skew" + echo $OUTPUT_PREFIX + sed -i '$ d' "properties/benchmarks/ycsb.properties" + echo "skew_factor = $skew" >> "properties/benchmarks/ycsb.properties" + +# ANTICACHE_BLOCK_SIZE=1048576 + + ANTICACHE_BLOCK_SIZE=262144 + ANTICACHE_THRESHOLD=.5 + + BASE_ARGS=( \ + # SITE DEBUG + "-Dsite.status_enable=false" \ + "-Dsite.status_interval=10000" \ + # "-Dsite.status_exec_info=true" \ + # "-Dsite.status_check_for_zombies=true" \ + # "-Dsite.exec_profiling=true" \ + # "-Dsite.profiling=true" \ + # "-Dsite.txn_counters=true" \ + # "-Dsite.pool_profiling=true" \ + # "-Dsite.network_profiling=false" \ + # "-Dsite.log_backup=true"\ + # "-Dnoshutdown=true" \ + + # Site Params + "-Dsite.jvm_asserts=false" \ + "-Dsite.specexec_enable=false" \ + "-Dsite.cpu_affinity_one_partition_per_core=true" \ + #"-Dsite.cpu_partition_blacklist=0,2,4,6,8,10,12,14,16,18" \ + #"-Dsite.cpu_utility_blacklist=0,2,4,6,8,10,12,14,16,18" \ + "-Dsite.network_incoming_limit_txns=50000" \ + "-Dsite.commandlog_enable=false" \ + "-Dsite.txn_incoming_delay=5" \ + "-Dsite.exec_postprocessing_threads=false" \ + "-Dsite.anticache_eviction_distribution=even" \ + "-Dsite.log_dir=$LOG_PREFIX" \ + "-Dsite.specexec_enable=false" + + # "-Dsite.queue_allow_decrease=true" \ + # "-Dsite.queue_allow_increase=true" \ + # "-Dsite.queue_threshold_factor=0.5" \ + + # Client Params + "-Dclient.scalefactor=10" \ + "-Dclient.memory=2048" \ + "-Dclient.txnrate=3500" \ + "-Dclient.warmup=120000" \ + "-Dclient.duration=300000" \ + "-Dclient.interval=5000" \ + "-Dclient.shared_connection=false" \ + "-Dclient.blocking=true" \ + "-Dclient.blocking_concurrent=100" \ + "-Dclient.throttle_backoff=100" \ + "-Dclient.output_anticache_evictions=${OUTPUT_PREFIX}-evictions.csv" \ + "-Dclient.output_anticache_profiling=${OUTPUT_PREFIX}-acprofiling.csv" \ + "-Dclient.output_memory_stats=${OUTPUT_PREFIX}-memory.csv" \ + "-Dclient.weights=\"ReadRecord:50,UpdateRecord:50,*:0\"" + + # Anti-Caching Experiments + "-Dsite.anticache_enable=${ENABLE_ANTICACHE}" \ + "-Dsite.anticache_timestamps=${ENABLE_TIMESTAMPS}" \ + "-Dsite.anticache_batching=true" \ + "-Dsite.anticache_profiling=true" \ + "-Dsite.anticache_reset=false" \ + "-Dsite.anticache_block_size=${ANTICACHE_BLOCK_SIZE}" \ + "-Dsite.anticache_check_interval=5000" \ + "-Dsite.anticache_threshold_mb=500" \ + "-Dsite.anticache_blocks_per_eviction=200" \ + "-Dsite.anticache_max_evicted_blocks=1000000" \ + "-Dsite.anticache_db_blocks=$BLOCKING" \ + "-Dsite.anticache_dbtype=$DB" \ + # "-Dsite.anticache_evict_size=${ANTICACHE_EVICT_SIZE}" \ + "-Dsite.anticache_threshold=${ANTICACHE_THRESHOLD}" \ + "-Dclient.anticache_enable=false" \ + "-Dclient.anticache_evict_interval=5000" \ + "-Dclient.anticache_evict_size=102400" \ + "-Dclient.output_csv=${OUTPUT_PREFIX}-results.csv" \ + + # CLIENT DEBUG + "-Dclient.output_txn_counters=${OUTPUT_PREFIX}-txncounters.csv" \ + "-Dclient.output_clients=false" \ + "-Dclient.profiling=false" \ + "-Dclient.output_response_status=false" \ + "-Dclient.output_queue_profiling=${OUTPUT_PREFIX}-queue.csv" \ + "-Dclient.output_basepartitions=true" \ + #"-Dclient.jvm_args=\"-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-TraceClassUnloading\"" + ) + + EVICTABLE_TABLES=( \ + "USERTABLE" \ + ) + EVICTABLES="" + if [ "$ENABLE_ANTICACHE" = "true" ]; then + for t in ${EVICTABLE_TABLES[@]}; do + EVICTABLES="${t},${EVICTABLES}" + done + fi + + # Compile + HOSTS_TO_UPDATE=("$SITE_HOST") + for CLIENT_HOST in ${CLIENT_HOSTS[@]}; do + NEED_UPDATE=1 + for x in ${HOSTS_TO_UPDATE[@]}; do + if [ "$CLIENT_HOST" = "$x" ]; then + NEED_UPDATE=0 + break + fi + done + if [ $NEED_UPDATE = 1 ]; then + HOSTS_TO_UPDATE+=("$CLIENT_HOST") + fi + done + #for HOST in ${HOSTS_TO_UPDATE[@]}; do + #ssh $HOST "cd $BASE_DIR && git pull && ant compile" & + #done + wait + + ant compile + HSTORE_HOSTS="${SITE_HOST}:0:0-7" + NUM_CLIENTS=`expr 8 \* $BASE_CLIENT_THREADS` + SITE_MEMORY=`expr $BASE_SITE_MEMORY + \( 8 \* $BASE_SITE_MEMORY_PER_PARTITION \)` + + # BUILD PROJECT JAR + ant hstore-prepare \ + -Dproject=${BASE_PROJECT} \ + -Dhosts=${HSTORE_HOSTS} \ + -Devictable=${EVICTABLES} + test -f ${BASE_PROJECT}.jar || exit -1 + + # UPDATE CLIENTS + CLIENT_COUNT=0 + CLIENT_HOSTS_STR="" + for CLIENT_HOST in ${CLIENT_HOSTS[@]}; do + CLIENT_COUNT=`expr $CLIENT_COUNT + 1` + if [ ! -z "$CLIENT_HOSTS_STR" ]; then + CLIENT_HOSTS_STR="${CLIENT_HOSTS_STR}," + fi + CLIENT_HOSTS_STR="${CLIENT_HOSTS_STR}${CLIENT_HOST}" + done + + # DISTRIBUTE PROJECT JAR + for HOST in ${HOSTS_TO_UPDATE[@]}; do + if [ "$HOST" != $(hostname) ]; then + scp -r ${BASE_PROJECT}.jar ${HOST}:${BASE_DIR} & + fi + done + wait + + # EXECUTE BENCHMARK + ant hstore-benchmark ${BASE_ARGS[@]} \ + -Dproject=${BASE_PROJECT} \ + -Dkillonzero=false \ + -Dclient.threads_per_host=4 \ + -Dsite.memory=${SITE_MEMORY} \ + -Dclient.hosts=${CLIENT_HOSTS_STR} \ + -Dclient.count=${CLIENT_COUNT} + result=$? + if [ $result != 0 ]; then + exit $result + fi + done +done +done +done diff --git a/scripts/multitier/ycsb-single-tier-nvm.sh b/scripts/multitier/ycsb-single-tier-nvm.sh new file mode 100755 index 0000000000..c66c50b87b --- /dev/null +++ b/scripts/multitier/ycsb-single-tier-nvm.sh @@ -0,0 +1,251 @@ +#!/bin/bash + +#UtilityWorkMessage --------------------------------------------------------------------- + +trap onexit 1 2 3 15 +function onexit() { + local exit_status=${1:-$?} + pkill -f hstore.tag + exit $exit_status +} + +# --------------------------------------------------------------------- + +ENABLE_ANTICACHE=true + +#SITE_HOST="dev3.db.pdl.cmu.local" +SITE_HOST="localhost" + +CLIENT_HOSTS=( "localhost") + +#CLIENT_HOSTS=( \ +# "localhost" \ +# "localhost" \ +# "localhost" \ +# "localhost" \ +# ) +N_HOSTS=1 +BASE_CLIENT_THREADS=1 +CLIENT_THREADS_PER_HOST=4 +#BASE_SITE_MEMORY=8192 +#BASE_SITE_MEMORY_PER_PARTITION=1024 +BASE_SITE_MEMORY=8192 +BASE_SITE_MEMORY_PER_PARTITION=1024 +BASE_PROJECT="ycsb" +BASE_DIR=`pwd` +OUTPUT_DIR="/home/user/giardino/data-hstore/ycsb" +#BLK_CON=1 +BLK_EVICT=200 +AC_THRESH=200 +SCALE=4 +BLOCK_SIZE_KB=256 +DURATION_S=600 +WARMUP_S=0 +INTERVAL_S=10 +PARTITIONS=1 + +for BLK_CON in 1 10 50; do +for BLOCK_SIZE in 256; do +for BLOCKING in 'true' 'false'; do +for BLOCK_MERGE in 'false' 'true'; do + for DB in 'NVM' ; do + for skew in 0.8 1.01 1.25 4 8; do + for round in 1; do + if [ "$BLOCKING" = "true" ]; then + block='sync' + else + block='abrt' + fi + if [ "$BLOCK_MERGE" = "true" ]; then + block_merge='block' + else + block_merge='tuple' + fi + BLOCK_SIZE_KB=$BLOCK_SIZE + BLK_EVICT=$((51200 / $BLOCK_SIZE_KB)) + OUTPUT_PREFIX="$OUTPUT_DIR/ycsb-nvm/$round-ycsb1G-$block-$DB-S$skew-${PARTITIONS}p-${BLK_CON}c-${N_HOSTS}h-${CLIENT_THREADS_PER_HOST}ct-sc$SCALE-${BLOCK_SIZE_KB}kb-${BLK_EVICT}b-${AC_THRESH}th-${DURATION_S}s-${block_merge}" + LOG_PREFIX="/home/user/giardino/h-store/logs/ycsb-nvn/$round-ycsb1G-$block-$DB-S$skew-${PARTITIONS}p-${BLK_CON}c-${N_HOSTS}h-${CLIENT_THREADS_PER_HOST}ct-sc$SCALE-${BLOCK_SIZE_KB}kb-${BLK_EVICT}b-${AC_THRESH}th-${DURATION_S}s-${block_merge}" + echo "log = $LOG_PREFIX" + echo $OUTPUT_PREFIX + sed -i '$ d' "properties/benchmarks/ycsb.properties" + echo "skew_factor = $skew" >> "properties/benchmarks/ycsb.properties" + +#ANTICACHE_BLOCK_SIZE=65536 + +#ANTICACHE_BLOCK_SIZE=262144 + ANTICACHE_BLOCK_SIZE=$(($BLOCK_SIZE_KB * 1024)) + ANTICACHE_THRESHOLD=.5 + DURATION=$((${DURATION_S} * 1000)) + WARMUP=$((${WARMUP_S} * 1000)) + INTERVAL=$((${INTERVAL_S} * 1000)) + + BASE_ARGS=( \ +# SITE DEBUG + "-Dsite.status_enable=false" \ + "-Dsite.status_interval=10000" \ +# "-Dsite.status_exec_info=true" \ +# "-Dsite.status_check_for_zombies=true" \ +# "-Dsite.exec_profiling=true" \ +# "-Dsite.profiling=true" \ +# "-Dsite.txn_counters=true" \ +# "-Dsite.pool_profiling=true" \ +# "-Dsite.network_profiling=false" \ +# "-Dsite.log_backup=true"\ +# "-Dnoshutdown=true" \ + +# Site Params + "-Dsite.jvm_asserts=false" \ + "-Dsite.specexec_enable=false" \ + "-Dsite.cpu_affinity_one_partition_per_core=true" \ +#"-Dsite.cpu_partition_blacklist=0,2,4,6,8,10,12,14,16,18" \ +#"-Dsite.cpu_utility_blacklist=0,2,4,6,8,10,12,14,16,18" \ + "-Dsite.network_incoming_limit_txns=50000" \ + "-Dsite.commandlog_enable=false" \ + "-Dsite.txn_incoming_delay=5" \ + "-Dsite.exec_postprocessing_threads=false" \ + "-Dsite.anticache_eviction_distribution=even" \ + "-Dsite.log_dir=$LOG_PREFIX" \ + "-Dsite.specexec_enable=false" \ + +# "-Dsite.queue_allow_decrease=true" \ +# "-Dsite.queue_allow_increase=true" \ +# "-Dsite.queue_threshold_factor=0.5" \ + +# Client Params + "-Dclient.scalefactor=${SCALE}" \ + "-Dclient.memory=2048" \ + "-Dclient.txnrate=3500" \ + "-Dclient.warmup=${WARMUP}" \ + "-Dclient.duration=${DURATION}" \ + "-Dclient.interval=${INTERVAL}" \ + "-Dclient.shared_connection=false" \ + "-Dclient.blocking=true" \ + "-Dclient.blocking_concurrent=${BLK_CON}" \ +# "-Dclient.throttle_backoff=100" \ + "-Dclient.output_anticache_evictions=${OUTPUT_PREFIX}-evictions.csv" \ + "-Dclient.output_anticache_profiling=${OUTPUT_PREFIX}-acprofiling.csv" \ +# "-Dclient.output_anticache_access=${OUTPUT_PREFIX}-accesses.csv" \ + "-Dclient.output_memory_stats=${OUTPUT_PREFIX}-memory.csv" \ + "-Dclient.weights=\"ReadRecord:50,UpdateRecord:50,*:0\"" \ + +# Anti-Caching Experiments + "-Dsite.anticache_enable=${ENABLE_ANTICACHE}" \ + "-Dsite.anticache_timestamps=${ENABLE_TIMESTAMPS}" \ + "-Dsite.anticache_batching=true" \ + "-Dsite.anticache_profiling=true" \ + "-Dsite.anticache_reset=false" \ + "-Dsite.anticache_block_size=${ANTICACHE_BLOCK_SIZE}" \ + "-Dsite.anticache_check_interval=5000" \ + "-Dsite.anticache_threshold_mb=${AC_THRESH}" \ + "-Dsite.anticache_blocks_per_eviction=${BLK_EVICT}" \ + "-Dsite.anticache_max_evicted_blocks=1000000" \ + "-Dsite.anticache_dbsize=1540M" \ + "-Dsite.anticache_db_blocks=$BLOCKING" \ + "-Dsite.anticache_block_merge=$BLOCK_MERGE" \ + "-Dsite.anticache_dbtype=$DB" \ +# "-Dsite.anticache_evict_size=${ANTICACHE_EVICT_SIZE}" \ + "-Dsite.anticache_dir=/mnt/pmfs/aclevel0" \ + "-Dsite.anticache_threshold=${ANTICACHE_THRESHOLD}" \ + "-Dclient.anticache_enable=false" \ + "-Dclient.anticache_evict_interval=5000" \ + "-Dclient.anticache_evict_size=${ANTICACHE_BLOCK_SIZE}" \ + "-Dclient.output_csv=${OUTPUT_PREFIX}-results.csv" \ + +# CLIENT DEBUG + "-Dclient.output_txn_counters=${OUTPUT_PREFIX}-txncounters.csv" \ + "-Dclient.output_clients=false" \ + "-Dclient.profiling=false" \ + "-Dclient.output_response_status=false" \ + "-Dclient.output_queue_profiling=${OUTPUT_PREFIX}-queue.csv" \ + "-Dclient.output_basepartitions=true" \ +#"-Dclient.jvm_args=\"-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-TraceClassUnloading\"" + ) + + EVICTABLE_TABLES=( \ + "USERTABLE" \ + ) + EVICTABLES="" + if [ "$ENABLE_ANTICACHE" = "true" ]; then + for t in ${EVICTABLE_TABLES[@]}; do + EVICTABLES="${t},${EVICTABLES}" + done + fi + +# Compile + HOSTS_TO_UPDATE=("$SITE_HOST") + for CLIENT_HOST in ${CLIENT_HOSTS[@]}; do + NEED_UPDATE=1 + for x in ${HOSTS_TO_UPDATE[@]}; do + if [ "$CLIENT_HOST" = "$x" ]; then + NEED_UPDATE=0 + break + fi + done + if [ $NEED_UPDATE = 1 ]; then + HOSTS_TO_UPDATE+=("$CLIENT_HOST") + fi + done +#for HOST in ${HOSTS_TO_UPDATE[@]}; do +#ssh $HOST "cd $BASE_DIR && git pull && ant compile" & +#done + wait + + ant compile +#HSTORE_HOSTS="${SITE_HOST}:0:0-7" + if [ "$PARTITIONS" = "1" ]; then + HSTORE_HOSTS="${SITE_HOST}:0:0" + else + PART_NO=$((${PARTITIONS} - 1)) + HSTORE_HOSTS="${SITE_HOST}:0:0-$PART_NO" + fi + echo "$HSTORE_HOSTS" + + NUM_CLIENTS=$((${PARTITIONS} * ${BASE_CLIENT_THREADS})) + SITE_MEMORY=`expr $BASE_SITE_MEMORY + \( $PARTITIONS \* $BASE_SITE_MEMORY_PER_PARTITION \)` + +# BUILD PROJECT JAR + ant hstore-prepare \ + -Dproject=${BASE_PROJECT} \ + -Dhosts=${HSTORE_HOSTS} \ + -Devictable=${EVICTABLES} + test -f ${BASE_PROJECT}.jar || exit -1 + +# UPDATE CLIENTS + CLIENT_COUNT=0 + CLIENT_HOSTS_STR="" + for CLIENT_HOST in ${CLIENT_HOSTS[@]}; do + CLIENT_COUNT=`expr $CLIENT_COUNT + 1` + if [ ! -z "$CLIENT_HOSTS_STR" ]; then + CLIENT_HOSTS_STR="${CLIENT_HOSTS_STR}", + fi + CLIENT_HOSTS_STR="${CLIENT_HOSTS_STR}${CLIENT_HOST}" + done + +# DISTRIBUTE PROJECT JAR + for HOST in ${HOSTS_TO_UPDATE[@]}; do + if [ "$HOST" != $(hostname) ]; then + scp -r ${BASE_PROJECT}.jar ${HOST}:${BASE_DIR} & + fi + done + wait + + echo "Client count $CLIENT_COUNT client hosts: $CLIENT_HOSTS_STR" +# EXECUTE BENCHMARK + ant hstore-benchmark ${BASE_ARGS[@]} \ + -Dproject=${BASE_PROJECT} \ + -Dkillonzero=false \ + -Dclient.threads_per_host=${CLIENT_THREADS_PER_HOST} \ + -Dsite.memory=${SITE_MEMORY} \ + -Dclient.hosts=${CLIENT_HOSTS_STR} \ + -Dclient.count=${CLIENT_COUNT} + result=$? + if [ $result != 0 ]; then + exit $result + fi + done + done + done +done +done +done #BLOCK_SIZE +done #BLK_CON