osd: Send queued replies before a peering calculation #199
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:osd-reply-before-peering"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Follow-up to #197.
osd_t::loop()(src/osd/osd.cpp:612) runshandle_peers()first, thenread_requests(),send_replies()andsubmit(). The completions of a pass are handled before the consumers run, so when the loop gets toosd_t::loop(), the replies to the requests that came during a calculation are already queued. If the 1 ms yield timer from #197 fired in the same pass,handle_peers()starts the next calculation first, and those replies go out only after it.Without other load, the time after a calculation is idle and a ping is answered within it. With client I/O or LIST requests from peers, the first pass after a calculation takes longer than the 1 ms timer, so a ping waits for two calculations instead of one. With 2.5-3 s calculations (~850k objects per PG) two calculations are more than the default osd_ping_timeout (5 s).
The change:
continue_pg_peering()sends the queued replies and submits right beforecalc_object_states(). That covers both of its callers:handle_peers(), andcontinue_pg(), which calculates a re-peered PG at once (a re-peer keeps the lists of the peers that stay) from a completion callback, such as a lock reply or an etcd event, before the loop gets toosd_t::loop()at all. Passes without a calculation keep a single submit, so a busy OSD doesn't pay a secondio_uring_enterper pass.The test needed two hooks: the mock messenger's empty
send_replies()calls an optionalmock_send_replies_hook, andosd_test_fixture_tpasses the mock ring's submit callback to anon_submitmember.Found: by a benchmark, not seen in a run. A single-threaded loop on the real ring_loop_t + epoll_manager_t answers pings while it runs 11 calculations of 600k-object EC 8+2 PGs (~0.8 s each) and serves a client that keeps 1024 ops in flight at 10 us of loop CPU each.
Tested:
repeer_pgs()starts throughcontinue_pg(), and for one thathandle_peers()starts when the yield timer fires. It fails on master.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA