recovery_bench.py.
Fixes: 6535
Signed-off-by: Warren Usui <warren.usui@inktank.com>
+"""
+Run blktrace program through teuthology
+"""
import contextlib
import logging
@contextlib.contextmanager
def setup(ctx, config):
+ """
+ Setup all the remotes
+ """
osds = ctx.cluster.only(teuthology.is_type('osd'))
log_dir = '{tdir}/archive/performance/blktrace'.format(tdir=teuthology.get_testdir(ctx))
for remote, roles_for_host in osds.remotes.iteritems():
- log.info('Creating %s on %s' % (log_dir,remote.name))
+ log.info('Creating %s on %s' % (log_dir, remote.name))
remote.run(
args=['mkdir', '-p', '-m0755', '--', log_dir],
wait=False,
@contextlib.contextmanager
def execute(ctx, config):
+ """
+ Run the blktrace program on remote machines.
+ """
procs = []
- testdir=teuthology.get_testdir(ctx)
+ testdir = teuthology.get_testdir(ctx)
log_dir = '{tdir}/archive/performance/blktrace'.format(tdir=testdir)
osds = ctx.cluster.only(teuthology.is_type('osd'))
@contextlib.contextmanager
def task(ctx, config):
+ """
+ Usage:
+ blktrace:
+
+ Runs blktrace on all clients.
+ """
if config is None:
config = dict(('client.{id}'.format(id=id_), None)
for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client'))
+"""
+Remotely run peering tests.
+"""
import logging
import time
from teuthology import misc as teuthology
]
def setup(ctx, config):
+ """
+ Setup peering test on remotes.
+ """
first_mon = teuthology.get_first_mon(ctx, config)
(mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
ctx.manager = ceph_manager.CephManager(
log.info("done populating pool")
def do_run(ctx, config):
+ """
+ Perform the test.
+ """
start = time.time()
# mark in osd
ctx.manager.mark_in_osd(0)
+"""
+Process thrasher
+"""
import logging
import gevent
import random
self.run_time = self.config.get("run_time", 1000) # seconds
def log(self, msg):
+ """
+ Local log wrapper
+ """
self.logger.info(msg)
def start(self):
+ """
+ Start thrasher. This also makes sure that the greenlet interface
+ is used.
+ """
if self.greenlet is not None:
return
self.greenlet = gevent.Greenlet(self.loop)
self.greenlet.start()
def join(self):
+ """
+ Local join
+ """
self.greenlet.join()
def loop(self):
+ """
+ Thrashing loop -- loops at time intervals. Inside that loop, the
+ code loops through the individual procs, creating new procs.
+ """
time_started = time.time()
procs = []
self.log("Starting")
+"""
+Recovery system benchmarking
+"""
from cStringIO import StringIO
import contextlib
bench_proc.do_join()
class RecoveryBencher:
+ """
+ RecoveryBencher
+ """
def __init__(self, manager, config):
self.ceph_manager = manager
self.ceph_manager.wait_for_clean()
else:
def tmp(x):
+ """
+ Local wrapper to print value.
+ """
print x
self.log = tmp
self.thread = gevent.spawn(self.do_bench)
def do_join(self):
+ """
+ Join the recovery bencher. This is called after the main
+ task exits.
+ """
self.thread.get()
def do_bench(self):
+ """
+ Do the benchmarking.
+ """
duration = self.config.get("duration", 60)
num_objects = self.config.get("num_objects", 500)
io_size = self.config.get("io_size", 4096)
self.ceph_manager.raw_cluster_cmd('osd', 'in', osd)
def process_samples(self, input):
+ """
+ Extract samples from the input and process the results
+
+ :param input: input lines in JSON format
+ """
lat = {}
for line in input.split('\n'):
try:
samples = lat.setdefault(sample['type'], [])
samples.append(float(sample['latency']))
except Exception:
- pass
+ pass
for type in lat:
samples = lat[type]