You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating a tokio runtime will spawn a number of kernel threads equal to the number of logical cores on your system by default. However, context switching between two threads (belonging to the same process) can actually be faster than a full memory access when all caches are missed. To take advantage of this, some kernels (including Linux and Windows NT) will perform a context switch between threads of the same process to hide the latency of a main memory access.
Due to this, it may be best practice to spawn a number of kernel threads slightly greater than the number of logical cores on our system.
I'll do some testing soon on my own end to test this hypothesis. In the mean time, I'd appreciate any thoughts/comments/questions/advice!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Creating a tokio runtime will spawn a number of kernel threads equal to the number of logical cores on your system by default. However, context switching between two threads (belonging to the same process) can actually be faster than a full memory access when all caches are missed. To take advantage of this, some kernels (including Linux and Windows NT) will perform a context switch between threads of the same process to hide the latency of a main memory access.
Due to this, it may be best practice to spawn a number of kernel threads slightly greater than the number of logical cores on our system.
I'll do some testing soon on my own end to test this hypothesis. In the mean time, I'd appreciate any thoughts/comments/questions/advice!
Beta Was this translation helpful? Give feedback.
All reactions