Repository navigation
crimson/osd/osd_operations/client_request: make loading-obc concurrent - #55488
Conversation
c3d9c18 to
9d0379c
Compare
From previous discussions, Sam suggested to no longer use rados bench for perf testing exactly for this reason. IIUC, this is not an expected workload. @athanatos, please correct me if I'm wrong.
Note: The same applies with the way we handle MOSDMap, we have decided to avoid the complexity of handling concurrent MOSDMap messages in #51961 assuming the expected workloads shouldn't actually gain performance improvements from concurrent handling. The thrash tests would probably benefit from this but they only represent a testing workload. |
|
Yep, rados bench simply creates a sequence of objects of the specified size -- that's it. If you want to emulate a block workload, use fio. |
Not sure whether it is an appropriate decison when the change is directly related to the critical IO path -- a more appropriate/generally-better design might still be worthwhile even if we cannot prove real benefits yet, specifically:
Another challenge is that I can reliably reproduce the observation that "Critical IO requests can be stucked inside Crimson-OSD, waiting outside the OSD recover-missing phase because it is exclusive". But I cannot conclude how much this will impact the end performance without applying this PR. It might be none in this specific test case as the AlienStore seems to be already saturated, but it might be different in the future / with different hardware / with other unexpected factors (due to 2. above). So from the OSD performance perspective, I think the evaluation complexity can be reduced with this PR (due to 1. and the challenge above) as the OSD IO phases are more appropriately finer-grained. So that ObjectStore/Device performance issues will be less likely to be hidden behind larger exclusive phases in the OSD. |
I don't really agree that the "maybe_sync" change is more complex -- IIUC it is more general/explict to the fact that entering a new stage is not always meant to be asynchrous, by exposing And it doesn't seem complex to me to transform |
I have to admit that we are still trying to understand how to use fio to properly stress the OSD -- we are still in this direction. For example: If we want to compare the behavior of a stressed 1-core OSD and 32-core OSD, with the 1-core OSD got stressed by a 1-core fio client to 1 rbd image, which of the following ways is in-theory better (effective, fair and simple enough) to stress a 32-core OSD?
For 3., I think we also need to adjust pg numbers and image sizes properly to make sure comparing a stressed 32-core OSD with a 1-core OSD baseline is fair. Currently we use rados bench as an initial step to stress OSDs by cores, so that we don't need (yet) to worry about the extra complexities from rbd, before we have enough experiments to be confident about the appropriate method using fio. |
For this PR, specifically, I presumed that rados bench may be sufficient (from OSD perspective) to simulate/reproduce the case when the client IO pattern penetrates the obc-lru, so that obcs are mostly loaded from the store. |
|
Just let you know that I'm not able to respond in time in the following 2 weeks. |
|
load obc will call backend store, so how fast depend on store response(just read attr may return fast depend on the DB size and search speed.). But seems no much work to do after the last exclusive phase and before this concurrent phase, and the same thread read SSD, seems can't take benefit from the parallel mechanism in SSD, that maybe you didn't see performance improvement. The cleanup is reasonable, and if no performance degrade, for store read use concurrent will not block the work before it. |
Matan-B
left a comment
There was a problem hiding this comment.
Overall LGTM, some comments.
Naming changes are suggestions only, same as we have maybe_record_blocking. I think that "block" is friendlier than "sync".
There was a problem hiding this comment.
changed to is_enter_sync following the suggestion around introducing a safer version of enter_stage_sync()
What is the difference between running n clients vs 1 client running n jobs? Regarding the separate image per client, I'm not sure we should go this route yet. For this stage, I think that single image is more suitable for our comparisons at the moment. (Will try to investigate) (Let's move this discussion to the Slack channel since it's out of scope for this PR and will be easier to follow.) |
athanatos
left a comment
There was a problem hiding this comment.
I think I'm missing something with enter_stage_maybe_sync.
9d0379c to
61ddc74
Compare
|
@athanatos reviews should be addressed, please take a look. |
61ddc74 to
1c70faa
Compare
|
Something seems missing: |
|
I think the issue is related to ceph/src/crimson/osd/object_context.h Lines 124 to 131 in 622068c The lock should be promoted immediately upon locked -- this is why there are I think the described issue was hidden because the logic was protected by an exclusive lock. And the issue appears because this PR changes it to become really concurrent. |
1c70faa to
3a6332f
Compare
Should be fixed by 3a6332f, no longer happened in the tests. |
|
test: https://pulpito.ceph.com/yingxin-2024-04-02_02:45:18-crimson-rados-ci-yingxin-crimson-load-obc-4-distro-default-smithi/ OSDs didn't break in the above cases. Not sure the root causes yet... From osd logs, seems "7635336" is related to scrubbing. |
|
See:
And the log shows: This suggests that 16781865 firstly locking However, looking at |
|
Not only did they enter do_enter_maybe_sync out of order, 16781865 enters before 16781867 invokes mutex.unlock ("16781867: sync unlock"). |
|
Further investigations [1][2] showed that the issue is related to inappropriate exit (i.e. unlock) during request interruption, from a Specifically, the op (id=16778814) incorrectly called unlock before it really held the lock (see !) upon interruption, which caused the op 16778803 to become locked unexpectedly. This is why it looked as if both op 16778802 and op 16778803 were holding the lock at the same time (see *) , and finally led to incorrect order. Working on the fix. [1] https://github.com/ceph/ceph-ci/tree/ci-yingxin-crimson-load-obc-new-experiment-2 |
|
jenkins test make check |
…naps are empty Signed-off-by: Yingxin Cheng <[email protected]>
…missings Signed-off-by: Yingxin Cheng <[email protected]>
…Request::recover_missings Signed-off-by: Yingxin Cheng <[email protected]>
Signed-off-by: Yingxin Cheng <[email protected]>
…nc() Signed-off-by: Yingxin Cheng <[email protected]>
…sync() Signed-off-by: Yingxin Cheng <[email protected]>
…t during recover missing Signed-off-by: Yingxin Cheng <[email protected]>
Signed-off-by: Yingxin Cheng <[email protected]>
…rierI() Signed-off-by: Yingxin Cheng <[email protected]>
…esolved Specifically, OrderedExclusivePhaseT::mutex must be unlocked only after it is locked. Otherwise it can unlock other client requests unexpectedly, causing incorrect order upon exit. Signed-off-by: Yingxin Cheng <[email protected]>
4184b4e to
4a9ed13
Compare
These issues exist before this PR. Allowing to load obc concurrently seem to intensify them (or make them easier to be reproduced in thrash tests). @athanatos @Matan-B Are the test results look good to you? |
with_head_obc() uses get_cached_obc() to get_or_create obc instances. If the obc exists in cache, get_or_load_obc is called with `existed`=true. The assumption above is wrong. Cache existence (`existed`) only guarantees that the obc instance was created (and inserted) in the obc_registery. However, it does **not** assure that the obc was actually loaded. As obc-loading is now concurrent, it's possible for the first user to only create the obc in cache (without loading yet) and the second concurrent user to assume it was already loaded. With this patch, we verify that the obc was loaded in get_or_load_obc. * make loading-obc concurrent PR: ceph#55488 Fixes: https://tracker.ceph.com/issues/64206 Fixes: https://tracker.ceph.com/issues/66214 Signed-off-by: Matan Breizman <[email protected]>
with_head_obc() uses get_cached_obc() to get_or_create obc instances. If the obc exists in cache, get_or_load_obc is called with `existed`=true. The assumption above is wrong. Cache existence (`existed`) only guarantees that the obc instance was created (and inserted) in the obc_registery. However, it does **not** assure that the obc was actually loaded. As obc-loading is now concurrent, it's possible for the first user to only create the obc in cache (without loading yet) and the second concurrent user to assume it was already loaded. With this patch, we verify that the obc was loaded in get_or_load_obc. * make loading-obc concurrent PR: ceph#55488 Fixes: https://tracker.ceph.com/issues/64206 Fixes: https://tracker.ceph.com/issues/66214 Signed-off-by: Matan Breizman <[email protected]> (cherry picked from commit 0b90ee7)
Major changes:
std::optional<future<>> enter_stage_maybe_sync()so that the ordering can be preserved upon entering an ordered concurrent phase.with_obc()in ordered concurrent phases and useenter_stage_maybe_sync(), so that loading missing obcs from object store can become concurrent.Unfortunately, I'm not able to see improved performance in the local tests. So I dig into the waiting-for-load-obc issue which was initially observed:
Firstly, the issue isn't related to the read path. The hit ratio of obc-lru cache is good after increasing size to 512 (#55188), so normally read won't load missing obcs frequently.
Secondly, the issue only appears with alienstore -- reading from seastore is so fast that loading missing obcs won't accumulate.
I'm able to reproduce the issue using rados bench random 4K write to stress a 32-core crimson-osd/alienstore, it seems rados bench will always write to new objects in this case, so that obc always needs to be loaded from the store.
In this scenario and in the worst case, I saw in one shard, (e.g.) 2093 client-requests were waiting outside the exclusive
recover_missingphase, while 11 requests were pending insiderecover_missing, and the rest 55 requests were pending inside the concurrentwait_repopphase. Normally however, the issue isn't that serious, (e.g.) only 4/4/49 requests were in the according phases.Further analysis shows the requests inside
recover_missingwere mostly pending to load missing obcs from the alienstore.After this PR, in the worst case and in one shard, (e.g.) 8 requests were pending in the newly introduced concurrent
lock_obcphase, and the rest 3108 requests were pending in the concurrentwait_repopphase. Normally, (e.g.) 15/48 requests were in the according phases. This means all requests were pending in the alienstore.In short, after this PR, most of the IO requests are effectively pending in the store in the random 4K write rados-bench stressed scenario, and performance-not-improved is probably due to that the alienstore/bluestore was already saturated during my tests.
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e