Feature #25013
closedmds: add average session age (uptime) perf counter
0%
Description
Add a performance counter in the MDS to capture average age (uptime) of sessions. This should reflect the average uptime of ongoing and closed sessions (as a single perf stat). This was marked to be included in PR https://github.com/ceph/ceph/pull/22668 initially, but had to be carved out as a separate feature ticket due to pending discussions about the best method (in terms of correctness and efficiency) to calculate this stat.
Thoughts from earlier discussions:
You can add a public method to get the average session starttime: keep a running average of the starttimes (the co then divide by the number of sessions when computing the average. When adding a session:
avg_starttime = ((avg_starttime / (new_session_count)) * (new_session_count-1) + sesion_starttime/new_session_count
Removing is the reverse.
The tricky part is doing that with monotonic clock time points rather than unix epochs. @adamemerson, can you advise the right way to compute the average of a set of coarse_mono_time epochs? We need to be able to add/remove epochs from the set dynamically, using the math above ^
@batrick -- I think the average session age would need to be updated regularly (on each tick()) and not only on session add and remove. That way we would have the average uptime for ongoing sessions too which would be constantly refreshed (but is computationally expensive if there are huge number of sessions).