Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr: increase time resolution of Commit/Apply OSD latencies. #19232

Merged
merged 1 commit into from Feb 9, 2018
Merged

mgr: increase time resolution of Commit/Apply OSD latencies. #19232

merged 1 commit into from Feb 9, 2018

Conversation

socketpair
Copy link
Contributor

@socketpair socketpair commented Nov 29, 2017

As you can see, millisecond resolution is no enough for fast (Bluestore, ssd, NVME) storage monitoring

image

@socketpair
Copy link
Contributor Author

socketpair commented Nov 29, 2017

I have never compiled that, so please take a look on my idea and answer, should I continue or not.

src/mon/Paxos.cc Outdated
@@ -105,7 +105,7 @@ void Paxos::init_logger()
pcb.add_u64_avg(l_paxos_commit_keys, "commit_keys", "Keys in transaction on commit");
pcb.add_u64_avg(l_paxos_commit_bytes, "commit_bytes", "Data in transaction on commit");
pcb.add_time_avg(l_paxos_commit_latency, "commit_latency",
"Commit latency", "clat");
"Commit latency (ns)", "clat");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unshure what is it.

@shinobu-x
Copy link
Contributor

@socketpair socketpair changed the title (WIP) Increase precision of Commit/Apply OSD latencies (in performance moniroting) mgr: increase time resolution of Commit/Apply OSD latencies. Dec 6, 2017
f->dump_unsigned("commit_latency_ms", os_commit_latency);
f->dump_unsigned("apply_latency_ms", os_apply_latency);
// *_ms values just for compatibility.
f->dump_float("commit_latency_ms", os_commit_latency_ns / 1000000.0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note, unsigned -> float here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably the motivation for having commit_latency_ms in addition to commit_latency_ns is to have backward compatibility, so it probably doesn't make sense to change the type of the _ms field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But JSON (as a format) internally does not distinguish between int and float. So after my patch any correct application that reads JSON should see enhancement.

@jcsp
Copy link
Contributor

jcsp commented Jan 2, 2018

retest this please (jenkins)

@jcsp
Copy link
Contributor

jcsp commented Jan 2, 2018

This seems reasonable to me, I'd be on the fence about whether the _ms fields in objectstore_perf_stat_t::dump still need to be there at all, if we're outputting full resolution nanosecond data. The structure isn't backwards compatible in general. Any thoughts @tchaikov ?

@tchaikov tchaikov self-requested a review January 2, 2018 13:36
@socketpair
Copy link
Contributor Author

Tests failed. I can not figure out why.
consoleText.txt

Copy link
Contributor

@tchaikov tchaikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. i don't think we need to keep the _ms field if we already have _ns , unless there are other issues preventing us from doing so.

ENCODE_FINISH(bl);
}

void objectstore_perf_stat_t::decode(bufferlist::iterator &bl)
{
DECODE_START(1, bl);
::decode(os_commit_latency, bl);
::decode(os_apply_latency, bl);
::decode(os_commit_latency_ns, bl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not backward compatible: os_commit_latency_ns and os_apply_latency_ns are 64bits integers, while they were 32 bits before this change. that's why buffer::end_of_buffer exception is thrown when the test is trying to decode the encoded blob before this change using the new decoder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this blob intended for ? Should I fix tests or code ? Where does this blob used ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The objectstore stats get encoded and transmitted as part of MPGStats in OSD::send_pg_stats (via store->get_cur_stats).

That means that if you make this change in an OSD and someone has an older monitor, the monitor will crash when it tries to decode the message.

Increase the version on encoded structures (increment the first 1 in ENCODE_START in ::encode) and they'll still be understood by older daemons as long as fields are only added (not changed in place). Annoyingly, that means in this instance that the ::encode function needs to output two u32 fields (truncated from os_commit_latency_ns) and then follow those with the two u64 values. Then in ::decode you would decode two u32 values, then if the message version was >=2 you'd throw them away and decode two u64 values, else you'd stop.

Check out the (many) places in the ceph tree where " if (struct_v " fragments appear to see how that kind of conditional decoding is done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcsp Huge thanks. I have changed code by your advice.

@socketpair
Copy link
Contributor Author

@tchaikov

agreed. i don't think we need to keep the _ms field if we already have _ns , unless there are other issues preventing us from doing so.

Should I remove these fields in order to close review ?

@socketpair
Copy link
Contributor Author

@shinobu-x
@jcsp
@tchaikov

Please review. All tests passed.

@jcsp
Copy link
Contributor

jcsp commented Jan 22, 2018

Looks correct now, question is just are we okay with the increase in size of the encoded form (I think probably yes?)

@tchaikov tchaikov self-requested a review January 22, 2018 16:50
@tchaikov
Copy link
Contributor

tchaikov commented Jan 23, 2018

question is just are we okay with the increase in size of the encoded form (I think probably yes?)

probably we can avoid increasing the size of the MPGStats by complicating MPGStats::encode_payload() and MPGStats::decode_payload(). please note QOS_DMC was introduced in mimic. we can reused this feature bit in this release.

i prepared a change at tchaikov@e64ba65 to pass the features down to objectstore_perf_stat_t 's encoder.

probably we need to update the ceph-object-corpus submodule to add MPGStats to archive/12.0.0/forward_incompat.

@tchaikov tchaikov removed their request for review January 23, 2018 07:37
decode(commit_latency_ms, bl);
decode(apply_latency_ms, bl);
if (struct_v >= 2) {
decode(os_commit_latency_ns, bl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong indent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any auto-indentation script ?

Copy link
Contributor

@tchaikov tchaikov Jan 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@socketpair not yet, AFAICT. some developers (it not all) are using VIM or Emacs for editing source files. and these editors read the file variables at the first lines in the source files. for the coding style we are following, see https://github.com/ceph/ceph/blob/master/CodingStyle

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. FYI:

clang-format-3.9 -i -style="{BasedOnStyle: LLVM, IndentWidth: 2, BreakBeforeBraces: Linux, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false}" makes huge amount of changes. I think, someone should reformat sources using this (or another) tool and also add github check that patched sources do not change after automatic reformatting.

@socketpair
Copy link
Contributor Author

@tchaikov

i prepared a change at tchaikov/ceph@e64ba65

Should I cherry-pick your changes above my ones ?

@tchaikov
Copy link
Contributor

Should I cherry-pick your changes above my ones ?

@socketpair as long as you think it's correct.

Increase precision/resolution of time measurements in performance
monitoring. Affects only Commit/Apply OSD latencies.

Signed-off-by: Коренберг Марк <socketpair@gmail.com>
@socketpair
Copy link
Contributor Author

@tchaikov I kindly say that I will not merge your changes since I does not understand them. Please make separate PR after my PR is merged, if you want.

@socketpair
Copy link
Contributor Author

@tchaikov ping

@tchaikov
Copy link
Contributor

tchaikov commented Feb 5, 2018

@jcsp what do you think regarding to the idea of #19232 (comment) ?

@socketpair
Copy link
Contributor Author

Thanks, @tchaikov. What should I do in order to merge this PR ?

@tchaikov
Copy link
Contributor

tchaikov commented Feb 5, 2018

@socketpair i am adding the needs-qa label so this PR can be picked-up in a rados qa suite run. and in the meanwhile, we can wait for the insights from @jcsp .

@jcsp
Copy link
Contributor

jcsp commented Feb 5, 2018

@tchaikov since there is already a feature bit available in the release, your patch looks like a 👍 thing to do here to avoid bloating the encoded form

@tchaikov
Copy link
Contributor

tchaikov commented Feb 9, 2018

the failures are either caused by #19117 or tracked by http://tracker.ceph.com/issues/9356 .

@tchaikov
Copy link
Contributor

tchaikov commented Feb 9, 2018

thanks @jcsp , #20378 is posted.

@socketpair socketpair deleted the precision branch February 9, 2018 05:53
@socketpair
Copy link
Contributor Author

Thanks @tchaikov !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants