Skip to content

Commit 3ec6f49

Browse files
committed
Support automatic tests for the new DottedDB version with better FT.
1 parent 5f05240 commit 3ec6f49

File tree

1 file changed

+82
-41
lines changed

1 file changed

+82
-41
lines changed

benchmarks/dotted.py

+82-41
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,12 @@ def clock_entries_plot(type, DS,DE,BS,BE):
429429

430430

431431
## Sync Size Transferred
432-
def sync_paper4():
432+
def sync_paper4(
433+
types = ['hhh','hlh','lhh','llh','hhl','hll','lhl','lll'],
434+
# ['hhh','hhl','hlh','hll','lhh','lhl','llh','lll'],
435+
types2 = ['hh','lh','hl','ll'],
436+
# ['hh','hl','lh','ll'],
437+
filename_ext=''):
433438

434439
# Basic
435440
basic_mt = OrderedDict()
@@ -470,9 +475,7 @@ def sync_paper4():
470475
final_offset= 0
471476

472477

473-
# types = ['hhh']
474-
types = ['hhh','hlh','lhh','llh','hhl','hll','lhl','lll']
475-
# types = ['hhh','hhl','hlh','hll','lhh','lhl','llh','lll']
478+
# types = ['hhh','hlh','lhh','llh','hhl','hll','lhl','lll']
476479
for t in types:
477480
change_current_basic(cluster_path + 'cluster_basic/sync_'+t+'/')
478481

@@ -504,9 +507,7 @@ def sync_paper4():
504507
basic_total[t] = (basic_ctx[t][BS[t]:BE[t],10] + basic_md[t][BS[t]:BE[t],10] + basic_pl[t][BS[t]:BE[t],10])
505508

506509

507-
types2 = ['hh','lh','hl','ll']
508-
# types2 = ['hh','hl','lh','ll']
509-
# types2 = ['hh','hl']
510+
# types2 = ['hh','lh','hl','ll']
510511
for t in types2:
511512
change_current_dotted(cluster_path + 'cluster_dotted/sync_'+t+'/')
512513

@@ -587,7 +588,7 @@ def sync_paper4():
587588
# plt.xlim(xmin=-5)
588589
# plt.xlim(xmax=(BE['hhh']-BS['hhh'])*5 - 40)
589590
# plt.ylim(ymin=-0.5)
590-
pp = PdfPages(test_path + 'sync_size_bar_abs_paper.pdf')
591+
pp = PdfPages(test_path + 'sync_size_bar_abs_paper' + filename_ext + '.pdf')
591592
pp.savefig()
592593
pp.close()
593594

@@ -628,7 +629,7 @@ def sync_paper4():
628629
# plt.xlim(xmin=-5)
629630
# plt.xlim(xmax=(BE['hhh']-BS['hhh'])*5 - 40)
630631
# plt.ylim(ymin=-0.5)
631-
pp = PdfPages(test_path + 'sync_size_pct_bar_paper.pdf')
632+
pp = PdfPages(test_path + 'sync_size_pct_bar_paper' + filename_ext + '.pdf')
632633
pp.savefig()
633634
pp.close()
634635

@@ -667,7 +668,7 @@ def sync_paper4():
667668
# plt.xlim(xmin=-5)
668669
# plt.xlim(xmax=(BE['hhh']-BS['hhh'])*5 - 40)
669670
# plt.ylim(ymin=-0.5)
670-
pp = PdfPages(test_path + 'sync_size_pct_bar_ctx_paper.pdf')
671+
pp = PdfPages(test_path + 'sync_size_pct_bar_ctx_paper' + filename_ext + '.pdf')
671672
pp.savefig()
672673
pp.close()
673674

@@ -707,7 +708,7 @@ def sync_paper4():
707708
# plt.xlim(xmin=-5)
708709
# plt.xlim(xmax=(BE['hhh']-BS['hhh'])*5 - 40)
709710
# plt.ylim(ymin=-0.5)
710-
pp = PdfPages(test_path + 'sync_size_pct_bar_md_paper.pdf')
711+
pp = PdfPages(test_path + 'sync_size_pct_bar_md_paper' + filename_ext + '.pdf')
711712
pp.savefig()
712713
pp.close()
713714

@@ -740,7 +741,7 @@ def sync_paper4():
740741
plt.xlim(xmin=-5)
741742
plt.xlim(xmax=(BE['hhh']-BS['hhh'])*5)
742743
plt.ylim(ymin=-5)
743-
pp = PdfPages(test_path + 'sync_size_basic_paper.pdf')
744+
pp = PdfPages(test_path + 'sync_size_basic_paper' + filename_ext + '.pdf')
744745
pp.savefig()
745746
pp.close()
746747

@@ -758,9 +759,9 @@ def sync_paper4():
758759
plt.legend(loc='upper right')
759760
# plt.ylim((-1,62))
760761
plt.xlim(xmin=-5)
761-
plt.xlim(xmax=(DE['hh']-DS['hh'])*5)
762+
plt.xlim(xmax=(DE[types2[0]]-DS[types2[0]])*5)
762763
plt.ylim(ymin=-5)
763-
pp = PdfPages(test_path + 'sync_size_dotted_paper.pdf')
764+
pp = PdfPages(test_path + 'sync_size_dotted_paper' + filename_ext + '.pdf')
764765
pp.savefig()
765766
pp.close()
766767

@@ -828,7 +829,12 @@ def sync_size_plot(type, DS,DE,BS,BE):
828829

829830

830831
## Repair Latency
831-
def sync_paper3():
832+
def sync_paper3(
833+
types = ['hhh','hhl','hlh','hll','lhh','lhl','llh','lll'],
834+
types2 = ['hh','hl','lh','ll'],
835+
filename_ext=''):
836+
837+
832838
basic = {}
833839
basicX = {}
834840
basicY = {}
@@ -840,7 +846,7 @@ def sync_paper3():
840846
dottedY2 = {}
841847
dotted_ecdf = {}
842848

843-
types = ['hhh','hhl','hlh','hll','lhh','lhl','llh','lll']
849+
# types = ['hhh','hhl','hlh','hll','lhh','lhl','llh','lll']
844850
for t in types:
845851
change_current_basic(cluster_path + 'cluster_basic/sync_'+t+'/')
846852
basic[t] = load_cluster_basic_csv('write-latency_gauge.csv', False)
@@ -849,7 +855,7 @@ def sync_paper3():
849855
basicX[t] = np.linspace(min(basicY[t]), max(basicY[t]))
850856
basicY2[t] = basic_ecdf[t](basicX[t])
851857

852-
types2 = ['hh','hl','lh','ll']
858+
# types2 = ['hh','hl','lh','ll']
853859
for t in types2:
854860
change_current_dotted(cluster_path + 'cluster_dotted/sync_'+t+'/')
855861
dotted[t] = load_cluster_dotted_csv('write-latency_gauge.csv', False)
@@ -869,7 +875,8 @@ def sync_paper3():
869875
# plt.title("10000 ms Sync Interval, 100% Replication Loss")
870876
t1 = 'hhh'
871877
t2 = 'lhh'
872-
t3 = 'hh'
878+
# t3 = 'hh'
879+
t3 = types2[0]
873880
plt.step(basicX[t1]/1000.0, basicY2[t1], label="BasicDB, High MT/Leaf Ratio", lw=l, marker=ms[0], alpha=0.6, color='b')
874881
plt.step(basicX[t2]/1000.0, basicY2[t2], label="BasicDB, Low MT/Leaf Ratio", lw=l, marker=ms[1], alpha=0.6, color='r')
875882
plt.step(dottedX[t3]/1000.0, dottedY2[t3], label="DottedDB", lw=l, marker=ms[3], alpha=0.6, color='g')
@@ -879,7 +886,7 @@ def sync_paper3():
879886
plt.xlim(xmin=-0.5)
880887
plt.xlim(xmax=990)
881888
plt.ylim(ymax=1.05)
882-
pp = PdfPages(test_path + 'repair_latency_hh_paper.pdf')
889+
pp = PdfPages(test_path + 'repair_latency_hh_paper' + filename_ext + '.pdf')
883890
pp.savefig()
884891
pp.close()
885892

@@ -891,7 +898,8 @@ def sync_paper3():
891898
# plt.title("10000 ms Sync Interval, 20% Replication Loss")
892899
t1 = 'hhl'
893900
t2 = 'lhl'
894-
t3 = 'hl'
901+
# t3 = 'hl'
902+
t3 = types2[1]
895903
plt.step(basicX[t1]/1000.0, basicY2[t1], label="BasicDB, High MT/Leaf Ratio", lw=l, marker=ms[0], alpha=0.6, color='b')
896904
plt.step(basicX[t2]/1000.0, basicY2[t2], label="BasicDB, Low MT/Leaf Ratio", lw=l, marker=ms[1], alpha=0.6, color='r')
897905
plt.step(dottedX[t3]/1000.0, dottedY2[t3], label="DottedDB", lw=l, marker=ms[3], alpha=0.6, color='g')
@@ -901,7 +909,7 @@ def sync_paper3():
901909
plt.xlim(xmin=-0.5)
902910
plt.xlim(xmax=195)
903911
plt.ylim(ymax=1.05)
904-
pp = PdfPages(test_path + 'repair_latency_hl_paper.pdf')
912+
pp = PdfPages(test_path + 'repair_latency_hl_paper' + filename_ext + '.pdf')
905913
pp.savefig()
906914
pp.close()
907915

@@ -913,7 +921,8 @@ def sync_paper3():
913921
# plt.title("100 ms Sync Interval, 100% Replication Loss")
914922
t1 = 'hlh'
915923
t2 = 'llh'
916-
t3 = 'lh'
924+
# t3 = 'lh'
925+
t3 = types2[2]
917926
plt.step(basicX[t1]/1000.0, basicY2[t1], label="BasicDB, High MT/Leaf Ratio", lw=l, marker=ms[0], alpha=0.6, color='b')
918927
plt.step(basicX[t2]/1000.0, basicY2[t2], label="BasicDB, Low MT/Leaf Ratio", lw=l, marker=ms[1], alpha=0.6, color='r')
919928
plt.step(dottedX[t3]/1000.0, dottedY2[t3], label="DottedDB", lw=l, marker=ms[3], alpha=0.6, color='g')
@@ -923,7 +932,7 @@ def sync_paper3():
923932
plt.xlim(xmin=-0.5)
924933
plt.xlim(xmax=790)
925934
plt.ylim(ymax=1.05)
926-
pp = PdfPages(test_path + 'repair_latency_lh_paper.pdf')
935+
pp = PdfPages(test_path + 'repair_latency_lh_paper' + filename_ext + '.pdf')
927936
pp.savefig()
928937
pp.close()
929938

@@ -935,7 +944,8 @@ def sync_paper3():
935944
# plt.title("100 ms Sync Interval, 20% Replication Loss")
936945
t1 = 'hll'
937946
t2 = 'lll'
938-
t3 = 'll'
947+
# t3 = 'll'
948+
t3 = types2[3]
939949
plt.step(basicX[t1]/1000.0, basicY2[t1], label="BasicDB, High MT/Leaf Ratio", lw=l, marker=ms[0], alpha=0.6, color='b')
940950
plt.step(basicX[t2]/1000.0, basicY2[t2], label="BasicDB, Low MT/Leaf Ratio", lw=l, marker=ms[1], alpha=0.6, color='r')
941951
plt.step(dottedX[t3]/1000.0, dottedY2[t3], label="DottedDB", lw=l, marker=ms[3], alpha=0.6, color='g')
@@ -947,7 +957,7 @@ def sync_paper3():
947957
plt.xlim(xmin=-0.5)
948958
plt.xlim(xmax=68)
949959
plt.ylim(ymax=1.05)
950-
pp = PdfPages(test_path + 'repair_latency_ll_paper.pdf')
960+
pp = PdfPages(test_path + 'repair_latency_ll_paper' + filename_ext + '.pdf')
951961
pp.savefig()
952962
pp.close()
953963

@@ -1371,7 +1381,12 @@ def perf_paper():
13711381

13721382

13731383
## Hit Ratio
1374-
def sync_paper1():
1384+
def sync_paper1(
1385+
types = ['hhh','hhl','hlh','hll','lhh','lhl','llh','lll'],
1386+
types2 = ['hh','hl','lh','ll'],
1387+
filename_ext=''):
1388+
1389+
13751390
initial_offset= -1
13761391
final_offset= 0
13771392

@@ -1398,7 +1413,7 @@ def sync_paper1():
13981413
dotted_tm = {}
13991414
dotted3 = {}
14001415

1401-
types = ['hhh','hhl','hlh','hll','lhh','lhl','llh','lll']
1416+
# types = ['hhh','hhl','hlh','hll','lhh','lhl','llh','lll']
14021417
for t in types:
14031418
change_current_basic(cluster_path + 'cluster_basic/sync_'+t+'/')
14041419

@@ -1417,7 +1432,7 @@ def sync_paper1():
14171432
basic_pct[t] = np.array(map(lambda x: min(x,100), basic_pct0[t]))
14181433

14191434

1420-
types2 = ['hh','hl','lh','ll']
1435+
# types2 = ['hh','hl','lh','ll']
14211436
for t in types2:
14221437
change_current_dotted(cluster_path + 'cluster_dotted/sync_'+t+'/')
14231438

@@ -1455,7 +1470,7 @@ def sync_paper1():
14551470
plt.ylim((-1,62))
14561471
plt.xlim(xmin=-15)
14571472
plt.xlim(xmax=(BE['hhh']-BS['hhh'])*5 + 30)
1458-
pp = PdfPages(test_path + 'basic_hit_ratio_paper.pdf')
1473+
pp = PdfPages(test_path + 'basic_hit_ratio_paper' + filename_ext + '.pdf')
14591474
pp.savefig()
14601475
pp.close()
14611476

@@ -1478,10 +1493,10 @@ def sync_paper1():
14781493
# plt.ylim(ymin=-150.0)
14791494
plt.ylim((75,100.3))
14801495
plt.xlim(xmin=-15)
1481-
plt.xlim(xmax=(DE['hh']-DS['hh'])*5 + 30)
1496+
plt.xlim(xmax=(DE[types2[0]]-DS[types2[0]])*5 + 30)
14821497
# plt.xlim(xmax=1375)
14831498
# save in PDF
1484-
pp = PdfPages(test_path + 'dotted_hit_ratio_paper.pdf')
1499+
pp = PdfPages(test_path + 'dotted_hit_ratio_paper' + filename_ext + '.pdf')
14851500
pp.savefig()
14861501
pp.close()
14871502

@@ -1507,7 +1522,7 @@ def sync_paper1():
15071522
plt.ylim((-1,101))
15081523
plt.xlim(xmin=-15)
15091524
plt.xlim(xmax=(BE['hhh']-BS['hhh'])*5 + 30)
1510-
pp = PdfPages(test_path + 'hit_ratio_paper.pdf')
1525+
pp = PdfPages(test_path + 'hit_ratio_paper' + filename_ext + '.pdf')
15111526
pp.savefig()
15121527
pp.close()
15131528

@@ -1572,11 +1587,15 @@ def sync_hit_ratio_plot(type, DS,DE,BS,BE):
15721587

15731588

15741589
## Sync Metadata
1575-
def sync_paper2():
1590+
def sync_paper2(
1591+
types = ['hhh','hhl','hlh','hll','lhh','lhl','llh','lll'],
1592+
types2 = ['hh','hl','lh','ll'],
1593+
filename_ext=''):
1594+
1595+
15761596
initial_offset= -1
15771597
final_offset= 0
15781598

1579-
15801599
# Basic
15811600
basic_total = {}
15821601
basic_mt = {}
@@ -1602,7 +1621,7 @@ def sync_paper2():
16021621

16031622
mt_metadata = 11
16041623

1605-
types = ['hhh','hhl','hlh','hll','lhh','lhl','llh','lll']
1624+
# types = ['hhh','hhl','hlh','hll','lhh','lhl','llh','lll']
16061625
for t in types:
16071626
change_current_basic(cluster_path + 'cluster_basic/sync_'+t+'/')
16081627

@@ -1627,7 +1646,7 @@ def sync_paper2():
16271646
basic_total[t].fill(basic_size[t])
16281647
print str(basic_size[t]/1024.0) + " KB\n"
16291648

1630-
types2 = ['hh','hl','lh','ll']
1649+
# types2 = ['hh','hl','lh','ll']
16311650
for t in types2:
16321651
change_current_dotted(cluster_path + 'cluster_dotted/sync_'+t+'/')
16331652

@@ -1684,7 +1703,7 @@ def sync_paper2():
16841703
plt.xlim(xmin=-5)
16851704
plt.xlim(xmax=(BE['hhh']-BS['hhh'])*5)
16861705
plt.ylim(ymin=-5)
1687-
pp = PdfPages(test_path + 'sync_metadata_paper.pdf')
1706+
pp = PdfPages(test_path + 'sync_metadata_paper' + filename_ext + '.pdf')
16881707
pp.savefig()
16891708
pp.close()
16901709

@@ -1964,6 +1983,11 @@ def main(argv):
19641983
clock_entries_paper()
19651984
elif arg1 == 'deletes':
19661985
deletes_paper()
1986+
elif arg1 == 'strip':
1987+
strip_paper()
1988+
elif arg1 == 'perf':
1989+
perf_paper()
1990+
# for normal KL and VV (1st version of SWC)
19671991
elif arg1 == 'sync1':
19681992
sync_paper1() # hit ratio
19691993
elif arg1 == 'sync2':
@@ -1972,10 +1996,27 @@ def main(argv):
19721996
sync_paper3() # repair latency
19731997
elif arg1 == 'sync4':
19741998
sync_paper4() # sync size
1975-
elif arg1 == 'strip':
1976-
strip_paper()
1977-
elif arg1 == 'perf':
1978-
perf_paper()
1999+
# for matrix watermark (2nd version of SWC)
2000+
elif arg1 == 'sync1m':
2001+
sync_paper1( # hit ratio
2002+
['hhh','hhl','hlh','hll','lhh','lhl','llh','lll'],
2003+
['hh_mat','hl_mat','lh_mat','ll_mat'],
2004+
'_matrix')
2005+
elif arg1 == 'sync2m':
2006+
sync_paper2( # metadata size
2007+
['hhh','hhl','hlh','hll','lhh','lhl','llh','lll'],
2008+
['hh_mat','hl_mat','lh_mat','ll_mat'],
2009+
'_matrix')
2010+
elif arg1 == 'sync3m':
2011+
sync_paper3( # repair latency
2012+
['hhh','hhl','hlh','hll','lhh','lhl','llh','lll'],
2013+
['hh_mat','hl_mat','lh_mat','ll_mat'],
2014+
'_matrix')
2015+
elif arg1 == 'sync4m':
2016+
sync_paper4( # sync size
2017+
['hhh','hlh','lhh','llh','hhl','hll','lhl','lll'],
2018+
['hh_mat','lh_mat','hl_mat','ll_mat'],
2019+
'_matrix')
19792020
else:
19802021
print "No args :("
19812022

0 commit comments

Comments
 (0)