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
Conversation
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"); |
There was a problem hiding this comment.
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.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note, unsigned -> float here
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
retest this please (jenkins) |
This seems reasonable to me, I'd be on the fence about whether the |
Tests failed. I can not figure out why. |
There was a problem hiding this 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.
src/osd/osd_types.cc
Outdated
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Should I remove these fields in order to close review ? |
Please review. All tests passed. |
Looks correct now, 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 i prepared a change at tchaikov@e64ba65 to pass the probably we need to update the ceph-object-corpus submodule to add MPGStats to |
src/osd/osd_types.cc
Outdated
decode(commit_latency_ms, bl); | ||
decode(apply_latency_ms, bl); | ||
if (struct_v >= 2) { | ||
decode(os_commit_latency_ns, bl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong indent.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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>
@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. |
@tchaikov ping |
@jcsp what do you think regarding to the idea of #19232 (comment) ? |
Thanks, @tchaikov. What should I do in order to merge this PR ? |
@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 . |
@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 |
the failures are either caused by #19117 or tracked by http://tracker.ceph.com/issues/9356 . |
Thanks @tchaikov ! |
As you can see, millisecond resolution is no enough for fast (Bluestore, ssd, NVME) storage monitoring