Skip to content

Commit 139f5a3

Browse files
authored
Merge pull request ceph#64289 from sseshasa/wip-mclock-new-benchmark-mechanism
src/ceph_osd, osd: Implement running benchmark during OSD creation - Phase 1 Reviewed-by: Ronen Friedman <[email protected]> Reviewed-by: Samuel Just <[email protected]>
2 parents 1fc5167 + 74925d7 commit 139f5a3

File tree

4 files changed

+600
-154
lines changed

4 files changed

+600
-154
lines changed

src/ceph_osd.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ static void usage()
113113
<< " --debug_osd <N> set debug level (e.g. 10)\n"
114114
<< " --get-device-fsid PATH\n"
115115
<< " get OSD fsid for the given block device\n"
116+
<< " --run-benchmark run a throughput benchmark test against the OSD and dump the result\n"
116117
<< std::endl;
117118
generic_server_usage();
118119
}
@@ -151,6 +152,7 @@ int main(int argc, const char **argv)
151152
bool get_cluster_fsid = false;
152153
bool get_journal_fsid = false;
153154
bool get_device_fsid = false;
155+
bool run_benchmark = false;
154156
string device_path;
155157
std::string dump_pg_log;
156158
std::string osdspec_affinity;
@@ -190,6 +192,8 @@ int main(int argc, const char **argv)
190192
} else if (ceph_argparse_witharg(args, i, &device_path,
191193
"--get-device-fsid", (char*)NULL)) {
192194
get_device_fsid = true;
195+
} else if (ceph_argparse_flag(args, i, "--run-benchmark", (char*)NULL)) {
196+
run_benchmark = true;
193197
} else {
194198
++i;
195199
}
@@ -380,6 +384,23 @@ int main(int argc, const char **argv)
380384
if (mkkey) {
381385
forker.exit(0);
382386
}
387+
// Run a benchmark if specified
388+
if (run_benchmark) {
389+
store->mount();
390+
tl::expected<std::string, int> res =
391+
OSD::run_osd_bench(g_ceph_context, store.get());
392+
if (!res.has_value()) {
393+
int ret = res.error();
394+
derr << TEXT_RED << " ** ERROR: error running benchmark: "
395+
<< cpp_strerror(ret) << TEXT_NORMAL << dendl;
396+
cerr << " ** ERROR: error running benchmark: "
397+
<< cpp_strerror(ret) << std::endl;
398+
forker.exit(ret);
399+
}
400+
cout << res.value() << std::endl;
401+
store->umount();
402+
forker.exit(0);
403+
}
383404
if (mkjournal) {
384405
common_init_finish(g_ceph_context);
385406
int err = store->mkjournal();

0 commit comments

Comments
 (0)