-
I use LocalSet to spawn I want to know the pattern how to use LocalPoolHandle to balance the accepted connections to workers in async_tcp_server.
I am a fresher to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
A single Lua instance can utilize only a single core so a common practice is use a Lua instance per core and loadbalance work between VMs.
Given that Lua perfectly integrates with Rust async, one lua VM can process thousands connections simultaneously. |
Beta Was this translation helpful? Give feedback.
A single Lua instance can utilize only a single core so a common practice is use a Lua instance per core and loadbalance work between VMs.
If speak about accepting incoming tcp connections and balancing them between workers you can use approach described in https://docs.rs/tokio/latest/tokio/task/struct.LocalSet.html#use-inside-tokiospawn
Given that Lua perfectly integrates with Rust async, one lua VM can process thousands connections simultaneously.