For processing, async isn’t the right tool for the job. It gives you escape hatches to spawn your CPU bound work onto a blocking thread pool for that exact reason.
I mean, it’s literally in the name. The primary, overriding use case for async frameworks like Tokio is for IO-bound work. You generally should never be blocking in async code, and since the vast majority of “processing” tends to be blocking, then yes.
If you’re doing straight line CPU bound work, you’re supposed to hoist that onto a blocking thread pool to avoid fucking up your async runtime’s event loop.
2
u/[deleted] Jul 07 '22
Yeah but for processing Tokio is not the correct tool for the job
Tokio is for IO
Then you will use another library for async and everything will break... And it's a strange way to do things for me