Repository navigation
Expand file tree
/
Copy pathdisk_variability.py
More file actions
executable file
·82 lines (75 loc) · 2.92 KB
/
Copy pathdisk_variability.py
File metadata and controls
executable file
·82 lines (75 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python
# Copyright (c) 2011 Stanford University
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
"""Generates data for a recovery performance graph."""
from __future__ import division, print_function
from common import *
import config
from glob import glob
import math
import metrics
import recovery
import re
import sys
def median(l):
l = sorted(l)
if len(l) % 2 == 0:
return metrics.average(l[len(l)//2:len(l)//2+1])
else:
return l[len(l)//2]
if len(sys.argv) > 1:
recovery_dir = sys.argv[1]
else:
recovery_dir = 'logs/latest'
NUMBACKUPS = len(config.hosts)
TRIALS = 25
backups = [[] for i in range(NUMBACKUPS)]
for trial in range(TRIALS):
args = {}
args['num_servers'] = NUMBACKUPS
args['backups_per_server'] = 1
args['num_partitions'] = 12
args['object_size'] = 1024
args['replicas'] = 3
args['num_objects'] = (626012 * args['num_servers'] * 80 //
args['num_partitions'] // 640)
r = recovery.insist(**args)
print('->', r['ns'] / 1e6, 'ms', '(run %s)' % r['run'])
for i, backup in enumerate(r['metrics'].backups):
backups[i].append(
(backup.backup.storageReadBytes / 2**20) /
(backup.backup.storageReadTicks / backup.clockFrequency))
with open('%s/recovery/disk_variability.data' % top_path, 'w', 1) as dat:
for outliersPass in [False, True]:
for i, read in enumerate(sorted(backups, key=median)):
read.sort()
m = median(read)
# Mendenhall and Sincich method
q1 = read[int(math.ceil(1 * (len(read) + 1) / 4)) - 1]
q3 = read[int(math.floor(3 * (len(read) + 1) / 4)) - 1]
iqr = q3 - q1
include = []
outliers = []
for x in read:
if x < q1 - 1.5 * iqr or x > q3 + 1.5 * iqr:
outliers.append(x)
else:
include.append(x)
if outliersPass:
for outlier in outliers:
print(i, outlier, file=dat)
else:
print(i, min(include), q1, m, q3, max(include), file=dat)
print(file=dat)
print(file=dat)