Repository navigation
Expand file tree
/
Copy pathbackup_scale.py
More file actions
executable file
·76 lines (70 loc) · 3.27 KB
/
Copy pathbackup_scale.py
File metadata and controls
executable file
·76 lines (70 loc) · 3.27 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
#!/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.
Varies the number of backups feeding data to one recovery master.
"""
from __future__ import division, print_function
from common import *
import config
import metrics
import recovery
import subprocess
dat = open('%s/recovery/backup_scale.data' % top_path, 'w', 1)
for numBackups in range(3, len(config.hosts)):
print('Running recovery with %d backup(s)' % numBackups)
args = {}
args['num_servers'] = numBackups
args['backups_per_server'] = 1
args['num_partitions'] = 1
args['object_size'] = 1024
args['num_objects'] = 592950 # 600MB
args['master_ram'] = 8000
args['replicas'] = 3
r = recovery.insist(**args)
print('->', r['ns'] / 1e6, 'ms', '(run %s)' % r['run'])
masterCpuMs = metrics.average(
[(master.master.recoveryTicks / master.clockFrequency)
for master in r['metrics'].masters]) * 1e3
diskBandwidth = sum([(backup.backup.storageReadBytes +
backup.backup.storageWriteBytes) / 2**20
for backup in r['metrics'].backups]) * 1e9 / r['ns']
diskActiveMsPoints = [backup.backup.storageReadTicks * 1e3 /
backup.clockFrequency
for backup in r['metrics'].backups]
print(numBackups,
r['ns'] / 1e6,
masterCpuMs,
diskBandwidth,
metrics.average(diskActiveMsPoints),
min(diskActiveMsPoints),
max(diskActiveMsPoints),
metrics.average([master.master.logSyncTicks * 1e3 /
master.clockFrequency
for master in r['metrics'].masters]),
metrics.average([(master.master.replicationBytes * 8 / 2**30) /
(master.master.replicationTicks /
master.clockFrequency)
for master in r['metrics'].masters]),
metrics.average([(master.master.logSyncBytes * 8 / 2**30) /
(master.master.logSyncTicks /
master.clockFrequency)
for master in r['metrics'].masters]),
metrics.average([master.master.replicationTicks * 1e3 /
master.clockFrequency
for master in r['metrics'].masters]),
metrics.average([master.transport.clientRpcsActiveTicks * 1e3 /
master.clockFrequency
for master in r['metrics'].masters]),
file=dat)