Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions benchmark/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ def initialize_endpoints(self):
def prefill(self):
pass

def estimate_duration(self) -> int:
"""Return estimated total wall-clock seconds for all run-phase work.

The base implementation returns 0. Concrete benchmarks should override
this to sum up their configured ``time``, ``ramp``, and any prefill
durations so that :mod:`progress` can size the overall progress bar.
"""
return 0

def run(self):
if self.osd_ra and self.osd_ra_changed:
logger.info("Setting OSD Read Ahead to: %s", self.osd_ra)
Expand Down
6 changes: 6 additions & 0 deletions benchmark/fio.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ def exists(self):
return True
return False

def estimate_duration(self) -> int:
"""Estimate run-phase seconds: runtime + ramp time."""
total = int(self.time) if self.time is not None else 0
total += int(self.ramp) if self.ramp is not None else 0
return total

def initialize(self):
super(Fio, self).initialize()

Expand Down
120 changes: 72 additions & 48 deletions benchmark/getput.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,47 @@ def __init__(self, archive_dir, cluster, config):
super(Getput, self).__init__(archive_dir, cluster, config)

self.tmp_conf = self.cluster.tmp_conf
self.runtime = config.get('runtime', None)
self.container_prefix = config.get('container_prefix', 'cbt-getput')
self.object_prefix = config.get('object_prefix', 'cbt-getput')
self.procs = config.get('procs', 1)
self.ops_per_proc = config.get('ops_per_proc', None)
self.test = config.get('test', "p")
self.op_size = config.get('op_size', 4194304)
self.ctype = config.get('ctype', None)
self.debug = config.get('debug', None)
self.logops = config.get('logops', None)
self.grace = config.get('grace', None)
self.run_dir = '%s/osd_ra-%08d/op_size-%08d/procs-%08d/%s/%s' % (self.run_dir, int(self.osd_ra), int(self.op_size), int(self.procs), self.test, self.ctype)
self.out_dir = '%s/osd_ra-%08d/op_size-%08d/procs-%08d/%s/%s' % (self.archive_dir, int(self.osd_ra), int(self.op_size), int(self.procs), self.test, self.ctype)
self.pool_profile = config.get('pool_profile', 'default')
self.cmd_path = config.get('cmd_path', "/usr/bin/getput")
self.user = config.get('user', 'cbt')
self.subuser = '%s:swift' % self.user
self.key = config.get('key', 'vzCEkuryfn060dfee4fgQPqFrncKEIkh3ZcdOANY') # dummy key from ceph radosgw docs
self.auth_urls = config.get('auth', self.cluster.get_auth_urls())
self.runtime = config.get("runtime", None)
self.container_prefix = config.get("container_prefix", "cbt-getput")
self.object_prefix = config.get("object_prefix", "cbt-getput")
self.procs = config.get("procs", 1)
self.ops_per_proc = config.get("ops_per_proc", None)
self.test = config.get("test", "p")
self.op_size = config.get("op_size", 4194304)
self.ctype = config.get("ctype", None)
self.debug = config.get("debug", None)
self.logops = config.get("logops", None)
self.grace = config.get("grace", None)
self.run_dir = "%s/osd_ra-%08d/op_size-%08d/procs-%08d/%s/%s" % (
self.run_dir,
int(self.osd_ra),
int(self.op_size),
int(self.procs),
self.test,
self.ctype,
)
self.out_dir = "%s/osd_ra-%08d/op_size-%08d/procs-%08d/%s/%s" % (
self.archive_dir,
int(self.osd_ra),
int(self.op_size),
int(self.procs),
self.test,
self.ctype,
)
self.pool_profile = config.get("pool_profile", "default")
self.cmd_path = config.get("cmd_path", "/usr/bin/getput")
self.user = config.get("user", "cbt")
self.subuser = "%s:swift" % self.user
self.key = config.get("key", "vzCEkuryfn060dfee4fgQPqFrncKEIkh3ZcdOANY") # dummy key from ceph radosgw docs
self.auth_urls = config.get("auth", self.cluster.get_auth_urls())

def estimate_duration(self) -> int:
"""Estimate run-phase seconds from the configured runtime."""
return int(self.runtime) if self.runtime is not None else 0

def exists(self):
if os.path.exists(self.out_dir):
logger.info('Skipping existing test in %s.', self.out_dir)
logger.info("Skipping existing test in %s.", self.out_dir)
return True
return False

Expand All @@ -57,55 +75,61 @@ def initialize(self):
common.clean_remote_dir(self.run_dir)
common.make_remote_dir(self.run_dir)

logger.info('Pausing for 60s for idle monitoring.')
logger.info("Pausing for 60s for idle monitoring.")
MonitoringFactory.start("%s/idle_monitoring" % self.run_dir)
time.sleep(60)
MonitoringFactory.stop()

common.sync_files('%s/*' % self.run_dir, self.out_dir)
common.sync_files("%s/*" % self.run_dir, self.out_dir)

def mkcredfiles(self):
for i in range(0, len(self.auth_urls)):
cred = "export ST_AUTH=%s\\nexport ST_USER=%s\\nexport ST_KEY=%s" % (self.auth_urls[i], self.subuser, self.key)
common.pdsh(settings.getnodes('clients'), 'echo -e "%s" > %s/gw%02d.cred' % (cred, self.run_dir, i)).communicate()
cred = "export ST_AUTH=%s\\nexport ST_USER=%s\\nexport ST_KEY=%s" % (
self.auth_urls[i],
self.subuser,
self.key,
)
common.pdsh(
settings.getnodes("clients"), 'echo -e "%s" > %s/gw%02d.cred' % (cred, self.run_dir, i)
).communicate()

def mkgetputcmd(self, cred_file, gwnum):
# grab the executable to use
getput_cmd = '%s ' % self.cmd_path
getput_cmd = "%s " % self.cmd_path

# Set the options
if self.container_prefix is not None:
container_prefix_flag = '-c%s' % self.container_prefix
if self.ctype == 'byproc' or self.ctype == 'bynodegw':
container_prefix_flag = '%s-gw%s' % (container_prefix_flag, gwnum)
getput_cmd += '%s ' % container_prefix_flag
container_prefix_flag = "-c%s" % self.container_prefix
if self.ctype == "byproc" or self.ctype == "bynodegw":
container_prefix_flag = "%s-gw%s" % (container_prefix_flag, gwnum)
getput_cmd += "%s " % container_prefix_flag

# For now we'll only test distinct objects per client/gw
if self.object_prefix is not None:
getput_cmd += '-o%s-`%s`-gw%s ' % (self.object_prefix, common.get_fqdn_cmd(), gwnum)
getput_cmd += "-o%s-`%s`-gw%s " % (self.object_prefix, common.get_fqdn_cmd(), gwnum)
else:
getput_cmd += '-o`%s`-gw%s ' % (common.get_fqdn_cmd(), gwnum)
getput_cmd += "-o`%s`-gw%s " % (common.get_fqdn_cmd(), gwnum)

getput_cmd += '-s%s ' % self.op_size
getput_cmd += '-t%s ' % self.test
getput_cmd += '--procs %s ' % self.procs
getput_cmd += "-s%s " % self.op_size
getput_cmd += "-t%s " % self.test
getput_cmd += "--procs %s " % self.procs
if self.ops_per_proc is not None:
getput_cmd += '-n%s ' % self.ops_per_proc
getput_cmd += "-n%s " % self.ops_per_proc
if self.runtime is not None:
getput_cmd += '--runtime %s ' % self.runtime
getput_cmd += "--runtime %s " % self.runtime
if self.ctype is not None:
getput_cmd += '--ctype %s ' % self.ctype
getput_cmd += "--ctype %s " % self.ctype
if self.debug is not None:
getput_cmd += '--debug %s ' % self.debug
getput_cmd += "--debug %s " % self.debug
if self.logops is not None:
getput_cmd += '--logops %s ' % self.logops
getput_cmd += "--logops %s " % self.logops
if self.grace is not None:
getput_cmd += '--grace %s ' % self.grace
getput_cmd += "--grace %s " % self.grace

getput_cmd += '--cred %s ' % cred_file
getput_cmd += "--cred %s " % cred_file

# End the getput_cmd
getput_cmd += '> %s/output.gw%s' % (self.run_dir, gwnum)
getput_cmd += "> %s/output.gw%s" % (self.run_dir, gwnum)

return getput_cmd

Expand All @@ -120,37 +144,37 @@ def run(self):
self.cluster.dump_config(self.run_dir)

# Run the backfill testing thread if requested
if 'recovery_test' in self.cluster.config:
if "recovery_test" in self.cluster.config:
recovery_callback = self.recovery_callback
self.cluster.create_recovery_test(self.run_dir, recovery_callback)

# Run getput
MonitoringFactory.start(self.run_dir)
logger.info('Running getput %s test.' % self.test)
logger.info("Running getput %s test." % self.test)

ps = []
for i in range(0, len(self.auth_urls)):
cmd = self.mkgetputcmd("%s/gw%02d.cred" % (self.run_dir, i), i)
p = common.pdsh(settings.getnodes('clients'), cmd)
p = common.pdsh(settings.getnodes("clients"), cmd)
ps.append(p)
for p in ps:
p.wait()
MonitoringFactory.stop(self.run_dir)

# If we were doing recovery, wait until it's done.
if 'recovery_test' in self.cluster.config:
if "recovery_test" in self.cluster.config:
self.cluster.wait_recovery_done()

# Finally, get the historic ops
self.cluster.dump_historic_ops(self.run_dir)
common.sync_files('%s/*' % self.run_dir, self.out_dir)
common.sync_files("%s/*" % self.run_dir, self.out_dir)

def recovery_callback(self):
self.cleanup()

def cleanup(self):
cmd_name = pathlib.PurePath(self.cmd_path).name
common.pdsh(settings.getnodes('clients'), 'sudo killall -9 %s' % cmd_name).communicate()
common.pdsh(settings.getnodes("clients"), "sudo killall -9 %s" % cmd_name).communicate()

def __str__(self):
return "%s\n%s\n%s" % (self.run_dir, self.out_dir, super(Getput, self).__str__())
Loading