Re:Scipio: A Thread-per-Core Crate for Rust and Linux
by imtringued on Tuesday November 03, 2020 @10:28AM
(#24980484)
It's pretty much common knowledge that if you want linear performance scaling on a multiprocessor then each workload has to be effectively independent from the others. Synchronization and communication is expensive and only takes away from your per core performance but it never makes a given core faster. So yes, sharding is a critical part of this "thread per core" architecture.
Re:Scipio: A Thread-per-Core Crate for Rust and Linux
by gpderetta on Tuesday November 03, 2020 @11:04AM
(#24980828)
To be fair, concurrent writes do not scale, but single writers multiple readers work just fine, so you only need to an hard partition of writers and can allow all threads (or the appropriate NUMA subset) to access any data.
Re:Scipio: A Thread-per-Core Crate for Rust and Linux
by gpderetta on Tuesday November 03, 2020 @10:52AM
(#24980708)
binding user level threads to hardware cores without preemption is completely equivalent to the thread-per-core + coroutines, except that user level threads allow deep stacks (with all the benefits and issues that it implies).
In fact a well designed generic executor can be completely oblivious to whether it is scheduling plain closures, async functions or fibers. See for example boost.asio.
That said, I am not claiming thread-per-core is _the solution_ either, just saying that if you can partition data at application-level, you can make things run plenty fast. Of course, you’re also exposing yourself to other issues, like “hot shards” where some CPUs get disproportionately more work than others. However, as we scale to more and more cores, it seems inevitable that we must partition our systems at some level.