2013-10-12 08:28:27 +00:00
|
|
|
"""
|
|
|
|
Rados benchmarking
|
|
|
|
"""
|
2011-06-13 17:29:22 +00:00
|
|
|
import contextlib
|
|
|
|
import logging
|
|
|
|
|
2014-08-07 14:24:59 +00:00
|
|
|
from teuthology.orchestra import run
|
2013-01-23 20:37:39 +00:00
|
|
|
from teuthology import misc as teuthology
|
2011-06-13 17:29:22 +00:00
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
@contextlib.contextmanager
|
|
|
|
def task(ctx, config):
|
|
|
|
"""
|
|
|
|
Run radosbench
|
|
|
|
|
|
|
|
The config should be as follows:
|
|
|
|
|
|
|
|
radosbench:
|
|
|
|
clients: [client list]
|
|
|
|
time: <seconds to run>
|
2012-07-19 22:49:29 +00:00
|
|
|
pool: <pool to use>
|
2015-05-01 16:13:27 +00:00
|
|
|
size: write size to use
|
2017-06-13 22:17:57 +00:00
|
|
|
objectsize: object size to use
|
2014-02-18 20:13:19 +00:00
|
|
|
unique_pool: use a unique pool, defaults to False
|
2014-06-10 15:17:26 +00:00
|
|
|
ec_pool: create an ec pool, defaults to False
|
2017-06-13 22:17:57 +00:00
|
|
|
create_pool: create pool, defaults to True
|
2014-06-10 15:17:26 +00:00
|
|
|
erasure_code_profile:
|
|
|
|
name: teuthologyprofile
|
|
|
|
k: 2
|
|
|
|
m: 1
|
2017-06-30 18:59:39 +00:00
|
|
|
crush-failure-domain: osd
|
2015-09-11 20:52:41 +00:00
|
|
|
cleanup: false (defaults to true)
|
2017-06-13 22:17:57 +00:00
|
|
|
type: <write|seq|rand> (defaults to write)
|
2011-06-13 17:29:22 +00:00
|
|
|
example:
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- ceph:
|
2011-07-12 01:00:03 +00:00
|
|
|
- radosbench:
|
2011-06-13 17:29:22 +00:00
|
|
|
clients: [client.0]
|
|
|
|
time: 360
|
|
|
|
- interactive:
|
|
|
|
"""
|
|
|
|
log.info('Beginning radosbench...')
|
|
|
|
assert isinstance(config, dict), \
|
|
|
|
"please list clients to run on"
|
|
|
|
radosbench = {}
|
|
|
|
|
2013-01-23 20:37:39 +00:00
|
|
|
testdir = teuthology.get_testdir(ctx)
|
2016-03-25 01:06:05 +00:00
|
|
|
manager = ctx.managers['ceph']
|
2017-06-13 22:17:57 +00:00
|
|
|
runtype = config.get('type', 'write')
|
2013-01-23 20:37:39 +00:00
|
|
|
|
2015-10-08 17:08:54 +00:00
|
|
|
create_pool = config.get('create_pool', True)
|
2011-06-13 17:29:22 +00:00
|
|
|
for role in config.get('clients', ['client.0']):
|
|
|
|
assert isinstance(role, basestring)
|
|
|
|
PREFIX = 'client.'
|
|
|
|
assert role.startswith(PREFIX)
|
|
|
|
id_ = role[len(PREFIX):]
|
2014-03-27 16:35:28 +00:00
|
|
|
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
|
2011-06-13 17:29:22 +00:00
|
|
|
|
2014-06-10 15:17:26 +00:00
|
|
|
if config.get('ec_pool', False):
|
|
|
|
profile = config.get('erasure_code_profile', {})
|
|
|
|
profile_name = profile.get('name', 'teuthologyprofile')
|
2016-03-25 01:06:05 +00:00
|
|
|
manager.create_erasure_code_profile(profile_name, profile)
|
2014-06-10 15:17:26 +00:00
|
|
|
else:
|
|
|
|
profile_name = None
|
|
|
|
|
2015-09-11 20:52:41 +00:00
|
|
|
cleanup = []
|
|
|
|
if not config.get('cleanup', True):
|
|
|
|
cleanup = ['--no-cleanup']
|
2015-10-08 17:08:54 +00:00
|
|
|
|
|
|
|
pool = config.get('pool', 'data')
|
|
|
|
if create_pool:
|
|
|
|
if pool != 'data':
|
2016-03-25 01:06:05 +00:00
|
|
|
manager.create_pool(pool, erasure_code_profile_name=profile_name)
|
2015-05-01 16:13:27 +00:00
|
|
|
else:
|
2016-03-25 01:06:05 +00:00
|
|
|
pool = manager.create_pool_with_unique_name(erasure_code_profile_name=profile_name)
|
2012-07-19 22:49:29 +00:00
|
|
|
|
2019-01-05 02:56:56 +00:00
|
|
|
osize = config.get('objectsize', 65536)
|
2017-06-13 22:17:57 +00:00
|
|
|
if osize is 0:
|
|
|
|
objectsize = []
|
|
|
|
else:
|
|
|
|
objectsize = ['-o', str(osize)]
|
2019-01-05 02:56:56 +00:00
|
|
|
size = ['-b', str(config.get('size', 65536))]
|
2017-06-13 22:17:57 +00:00
|
|
|
# If doing a reading run then populate data
|
|
|
|
if runtype != "write":
|
|
|
|
proc = remote.run(
|
|
|
|
args=[
|
|
|
|
"/bin/sh", "-c",
|
|
|
|
" ".join(['adjust-ulimits',
|
|
|
|
'ceph-coverage',
|
|
|
|
'{tdir}/archive/coverage',
|
|
|
|
'rados',
|
|
|
|
'--no-log-to-stderr',
|
|
|
|
'--name', role]
|
|
|
|
+ size + objectsize +
|
|
|
|
['-p' , pool,
|
|
|
|
'bench', str(60), "write", "--no-cleanup"
|
|
|
|
]).format(tdir=testdir),
|
|
|
|
],
|
|
|
|
logger=log.getChild('radosbench.{id}'.format(id=id_)),
|
|
|
|
wait=True
|
|
|
|
)
|
|
|
|
size = []
|
|
|
|
objectsize = []
|
|
|
|
|
2011-06-13 17:29:22 +00:00
|
|
|
proc = remote.run(
|
2011-07-12 01:00:03 +00:00
|
|
|
args=[
|
2011-06-13 17:29:22 +00:00
|
|
|
"/bin/sh", "-c",
|
2013-09-08 22:12:51 +00:00
|
|
|
" ".join(['adjust-ulimits',
|
2013-02-06 19:16:52 +00:00
|
|
|
'ceph-coverage',
|
2013-01-23 20:37:39 +00:00
|
|
|
'{tdir}/archive/coverage',
|
2013-02-06 19:16:52 +00:00
|
|
|
'rados',
|
2014-11-10 04:48:35 +00:00
|
|
|
'--no-log-to-stderr',
|
2017-06-13 22:17:57 +00:00
|
|
|
'--name', role]
|
|
|
|
+ size + objectsize +
|
|
|
|
['-p' , pool,
|
|
|
|
'bench', str(config.get('time', 360)), runtype,
|
2015-09-11 20:52:41 +00:00
|
|
|
] + cleanup).format(tdir=testdir),
|
2011-06-13 17:29:22 +00:00
|
|
|
],
|
|
|
|
logger=log.getChild('radosbench.{id}'.format(id=id_)),
|
|
|
|
stdin=run.PIPE,
|
|
|
|
wait=False
|
|
|
|
)
|
|
|
|
radosbench[id_] = proc
|
|
|
|
|
|
|
|
try:
|
|
|
|
yield
|
|
|
|
finally:
|
2017-07-07 15:04:36 +00:00
|
|
|
timeout = config.get('time', 360) * 30 + 300
|
2014-03-08 14:01:00 +00:00
|
|
|
log.info('joining radosbench (timing out after %ss)', timeout)
|
2014-03-07 17:36:45 +00:00
|
|
|
run.wait(radosbench.itervalues(), timeout=timeout)
|
2012-07-19 22:49:29 +00:00
|
|
|
|
2015-10-08 17:08:54 +00:00
|
|
|
if pool is not 'data' and create_pool:
|
2016-03-25 01:06:05 +00:00
|
|
|
manager.remove_pool(pool)
|