|
Boost : |
From: Christian Mazakas (christian.mazakas_at_[hidden])
Date: 2024-07-16 20:29:04
On Tue, Jul 16, 2024 at 12:35â¯PM Niall Douglas via Boost <
boost_at_[hidden]> wrote:
> Employer's code, not mine. They'll be open sourcing everything next
> year, and unlike most promises of that kind in this situation they
> really will have to.
>
Hey, that sounds good to me!
I'd say that I have a somewhat naive use of io_uring. I just use liburing
and whatever that
API happens to expose. It does happen to expose quite a bit, however. I
feel like I'm always
learning new little tricks and flags. `IORING_SETUP_DEFER_TASKRUN` was a
neat one
to experiment with because it actually had tangible effects on my
scheduling code and showed
how fragile some of my code was to concurrency.
> But ... I don't agree with hard coding in C++ coroutines personally. I
> think Sender-Receiver (before WG21 corrupted it) is a better design
> choice here especially as if within a C++ coroutine you can co_await and
> it'll "just work" without any extra effort.
>
This is interesting. Asio was developed when there was no standardized
concurrency primitive
in C++. We now have one: c++20 coroutines. To me, the universal completion
token stuff was a
lot of try-hard and template bloat for a feature wasn't worth its weight.
But at the time, we didn't
know better because no one was doing this kind of stuff.
I think in hindsight, the universal completion token was a mistake. Maybe
Sender, Receiver abuses
all that ADL to avoid introducing templates here but I'm hesitant to
un-hardcode myself from coroutines
because being realistic, I imagine most C++ users really just wanna
`co_await some_socket_recv();`.
> I see in your github repo you are benching against ASIO. What kinds of
> results did you get?
>
Pretty alright.
I have benchmarks that attempt to measure both latency and throughput and
in general, I'm
like 1.75x faster than Asio, almost 2x. This includes builtin timeouts so I
use Beast's tcp_stream
for this purpose. I guess this affects the latency-based benchmark more but
for the throughput one,
io_uring's batched I/O and handling of it really starts to shine.
Anything where you can use multishot recv() effectively means you're going
to shred Asio or other
readiness-based models.
- Christian
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk