1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 15:07:43 +02:00

use "physical" cpu cores as default worker count

This commit is contained in:
Rob Ede
2021-12-08 05:37:06 +00:00
parent ba901c70df
commit 3a3d654cea
3 changed files with 10 additions and 7 deletions

View File

@ -33,9 +33,9 @@ async fn run() -> io::Result<()> {
let addr = ("127.0.0.1", 8080);
info!("starting server on port: {}", &addr.0);
// Bind socket address and start worker(s). By default, the server uses the number of available
// logical CPU cores as the worker count. For this reason, the closure passed to bind needs
// to return a service *factory*; so it can be created once per worker.
// Bind socket address and start worker(s). By default, the server uses the number of physical
// CPU cores as the worker count. For this reason, the closure passed to bind needs to return
// a service *factory*; so it can be created once per worker.
Server::build()
.bind("echo", addr, move || {
let count = Arc::clone(&count);