# Tokio: using core threads for cpu-heavy computation

**URL:** <https://users.rust-lang.org/t/tokio-using-core-threads-for-cpu-heavy-computation/83443>\
**Category:** help\
**Created:** [October 29, 2022, 7:22pm UTC](https://users.rust-lang.org/t/tokio-using-core-threads-for-cpu-heavy-computation/83443 "2022-10-29T19:22:38Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![alice](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/alice/32/9777_2.png) [@alice](https://users.rust-lang.org/u/alice)\
**Post date:** [October 29, 2022, 8:55pm UTC](https://users.rust-lang.org/t/tokio-using-core-threads-for-cpu-heavy-computation/83443/8 "2022-10-29T20:55:39Z")

</div>

You certainly can run CPU heavy things in a Tokio runtime, but it generally only makes sense if you _only_ use the runtime for CPU heavy things. Putting any network IO on the same runtime would be a pretty bad idea, since your IO would frequently end up pausing for a long time. At this point I usually ask why you wouldn't just use rayon instead, considering that rayon also provides one thread per CPU core, but it has become clear that there is demand for using Tokio in this way, even if I don't really understand why.

Regarding `spawn_blocking`, I actually point out that it is unsuited for CPU heavy stuff in [my article on blocking](https://ryhl.io/blog/async-what-is-blocking/). It is designed for blocking IO.

---

_[View the full topic](https://users.rust-lang.org/t/tokio-using-core-threads-for-cpu-heavy-computation/83443)._
