Repository navigation
rgw/beast: optimizations for request timeout - #43761
Conversation
9a2518f to
e5168f2
Compare
e5168f2 to
64d5894
Compare
There was a problem hiding this comment.
benchmarked performance (without the rgw/beast: timer pool logs with DoutPrefixProvider commit)
the results are very good, table of IO/s per branches and request_timeout_ms:
+--------------------------+-------------------------+--------+
| IO/s | wip-beast-timeout-alloc | master |
+--------------------------+-------------------------+--------+
| request_timeout_ms=65000 | 415 | 375 |
+--------------------------+-------------------------+--------+
| request_timeout_ms=0 | 421 | 412 |
+--------------------------+-------------------------+--------+
(benchmarked on the same environment as previous tests o07 sepia machine)
|
@mkogan1 Did you happen to grab CPU usage metrics when you ran your tests? I'd be curious to see if we also so a drop in overhead. |
did another quick CPU usage collection hsbench results in chronological order from left to right: |
|
thank you for the benchmarks @mkogan1! the main thing i'd like to see before merge is a comparison with/without the "rgw/beast: add custom allocator for timeout handlers" commit. it adds some atomics for reference counting and allocation state, so it's hard to tell whether those costs outweigh the benefit of fewer heap allocations. if the custom allocator doesn't help much, i'd rather not merge that part |
sure, just to make sure understood correctly - compare IO/s & CPU usage with and without commit 0f539b7 ? |
|
full hsbench logs in chronological order from left to right: |
|
adding comparison between full hsbench logs in chronological order from left to right: |
|
aggregating results from previous runs - without commit 0f539b7 the IO/s performance is slightly lower (and correspondingly the CPU usage is slightly lower also) |
|
thanks @mkogan1, that helps a lot. looking at the what do you think Mark? |
@cbodley yes, agree that the custom allocator is not showing a significant performance benefit |
64d5894 to
f43e6ae
Compare
|
ok, i removed the final 2 commits related to the custom allocator. this is ready for qa |
|
@cbodley I think there are some unrelated commits in the PR |
f43e6ae to
fc9d30b
Compare
|
i'm seeing a few crashes in teuthology: i assume it's coming from |
|
even with that fix to close(), valgrind does still complain that |
the #ifdef was covering more includes than it should have Signed-off-by: Casey Bodley <[email protected]>
the default spawn::yield_context uses the polymorphic boost::asio::executor to support any executor type rgw's beast frontend always uses the same executor type for these coroutines, so we can use that type directly to avoid the overhead of type erasure and virtual function calls Signed-off-by: Casey Bodley <[email protected]>
Signed-off-by: Casey Bodley <[email protected]>
remove the beast::tcp_stream wrapper from the socket, and track timeouts manually with a timeout_timer. this timer uses ceph's coarse_mono_clock which is cheaper to sample than std::chrono::steady_clock Signed-off-by: Casey Bodley <[email protected]>
resolves a use-after-free in the timeout_handler, where a timeout fires and schedules the timeout_handler for execution, but the coroutine exits and destroys the socket before asio executes the timeout_handler timeout_handler now holds a reference on the Connection to extend its lifetime now that the Connection is allocated on the heap, we can include the parse_buffer in this memory instead of allocating it separately Signed-off-by: Casey Bodley <[email protected]>
240cd06 to
a68fbb1
Compare
|
with the reference-counting fix, passed qa in https://pulpito.ceph.com/cbodley-2021-11-12_00:56:46-rgw-wip-beast-timeout-alloc-distro-basic-smithi/ |
|
jenkins test make check |
fixes all S3 operations failing with: `2021-11-15T15:46:05.992+0000 7ffee17fa700 20 failed to read header: Bad file descriptor` when `--rgw_frontends="beast port=8000 request_timeout_ms=0"` Signed-off-by: Mark Kogan <[email protected]>
|
thanks for the fix @mkogan1, the commit looks good 👍 are you satisfied with the results here? is there anything you'd change before merging? |
|
jenkins test make check |





3 separate performance optimizations for the beast frontend, described in https://tracker.ceph.com/issues/52333#note-13
commits 2 and 3 replace the polymorphic
boost::asio::executorwith the concreteboost::asio::io_context::executor_typetype. this eliminates one allocation for the initial type-erasure, along with the ongoing overhead of virtual functionscommit 4 replaces the use of
boost::beast::tcp_streamfor request timeouts with manual timeouts based onboost::asio::basic_waitable_timer. this lets us plug in theceph::coarse_mono_clockwhich is cheaper to sample than thestd::chrono::steady_clock* commit 5 adds a thread-safe allocator for timout completion handlers. each time we perform i/o on the stream, we callbasic_waitable_timer::async_wait()to rearm this timeout.async_wait()has to allocate memory for its completion handler, which is ourstruct timeout_handlerwrapped in boost's ownboost::asio::detail::wait_handler<T>commit 6 adds some log output to help with allocator debugging, but shouldn't be included for benchmarksChecklist
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 tox