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
rbd-mirror: improved replication statistics #34408
Conversation
The initial version mimics the existing ProgressContext callback interface. Later commits will add additional deep-copy unique methods. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
These simple stats will be utilized by rbd-mirror to compute throughput metrics for snapshot-based mirroring. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
When metrics are incorporated, there might not be a forced status update if no new data is available to replicate. However, we will want the metrics to decrease over time. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
The free-form journal replay status description is now JSON-encoded. The "master"/"mirror" designators have been changed to "primary"/"non_primary" to better align with RBD terminology. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
The mirror image status for replaying journal-based images now includes bytes and entries per second in addition to an estimated number of seconds until the image is fully synced. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This will make it cleaner and easier to add additional data fields to the existing JSON replaying status. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
The mirror image status for replaying snapshot-based images now includes bytes per second and per snapshot, in addition to an estimated number of seconds until the image is fully synced. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
|
||
if (m_entries_behind_master > 0 && entries_per_second > 0) { | ||
auto seconds_until_synced = round_to_two_places( | ||
m_entries_behind_master / entries_per_second); |
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.
Not sure if we want to improve this, but I think it will be underestimate if the primary image is actively writing at that time. If we had something like new_journal_entries_per_second
, for the case new_journal_entries_per_second << entries_per_second
the formula could be
seconds_until_synced = entries_behind_master / entries_per_second * (1 + new_journal_entries_per_second / entries_per_second)
For larger new_journal_entries_per_second
it would need to include additional terms, and if new_journal_entries_per_second >= entries_per_second
it would just mean that the sync never complete.
Alternatively I think we could estimate seconds_until_synced
by measuring the rate of entries_behind_master
change. If it is growing -- the sync will never complete. If it is decreasing, seconds_until_synced = entries_behind_master / rate
.
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 thought about that and had put something in initially to track it, but the issue is that it's going to be a highly inaccurate stat since we only discover new master entries every 30 seconds or so. Since we don't get the actual timestamp from the master position commit, we just have to guess that it's X entries per 30 seconds.
auto pending_bytes = bytes_per_snapshot * m_pending_snapshots; | ||
if (bytes_per_second > 0 && m_pending_snapshots > 0) { | ||
auto seconds_until_synced = round_to_two_places( | ||
pending_bytes / bytes_per_second); |
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 same here: in this estimate we don't include new bytes that are going to be added to the image during sync. If we had something like new_snapshots_per_second
, it could be:
seconds_until_synced = bytes_per_snapshot * pending_snapshots / bytes_per_second * (1 + new_snapshots_per_second * bytes_per_snapshot / bytes_per_second)
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.
If we can measure new snapshots in "snapshots per second", I think we have a problem. 😉
Once a new snapshot is added, the stats will update after it rescans the image since we now track how many snapshots we need to sync + the average number of bytes we copy per snapshot.
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.
Sure, "snapshots per second" is expected to be a float less than 1, e.g. if snapshots are created hourly it would be 1 / 3600
. Anyway, thinking more about it, I tend to agree there is no need in overcomplicating this.
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.
LGTM
@dillaman Running on teuthology, observing rbd-mirror crashes [1], though I don't see how it could be related here. For that run I had 3 crashes, with the same backtrace. Here is one case:
In the log I traced this pending request to
And for this replayer I see that it seemed to get stuck in unlink peer request:
Unfortunately I didn't find logs for the remote context to look deeper there. I looked at another case: /ceph/teuthology-archive/trociny-2020-04-07_18:48:34-rbd-wip-mgolub-testing-distro-basic-smithi/4932031/remote/smithi079/log/cluster1-client.mirror.1.15789.log.gz, and that time it also got stuck on unlink_peer (pending [1] http://pulpito.ceph.com/trociny-2020-04-07_18:48:34-rbd-wip-mgolub-testing-distro-basic-smithi/ |
That is something I have fixed in my in-progress work. There is a missing lock in Replayer::request_sync that can race with shutdown and cancel sync request. I can pull that one-liner out to a new PR / this PR to unstick testing. |
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
@trociny I pushed the sync race fix as the last commit. |
hi, any plans for backporting to N or M version ? |
There is plan to backport it to Nautilus. See https://tracker.ceph.com/issues/44727 and related. |
thanks. |
Checklist
Show available Jenkins commands
jenkins retest this please
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test dashboard backend
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox