cloudflare / pingora

A library for building fast, reliable and evolvable network services.
Apache License 2.0
20.28k stars 1.1k forks source link

service's threads is always None #192

Closed suningzh closed 2 months ago

suningzh commented 2 months ago

pingora-core/src/services/listening.rs has a struct named Service,it has a member threads, the threads is always None and we don't have a method to modify it, so when we run those services, they have same threads number which is come from conf.threads

while let Some(service) = self.services.pop() { let threads = service.threads().unwrap_or(conf.threads); let runtime = Server::run_service( service, self.listen_fds.clone(), self.shutdown_recv.clone(), threads, conf.work_stealing, ); runtimes.push(runtime); }

vicanso commented 2 months ago

You can try using it this way:

let mut lb = http_proxy_service(conf, self);
lb.threads = Some(10);
suningzh commented 2 months ago

You can try using it this way:

let mut lb = http_proxy_service(conf, self);
lb.threads = Some(10);

good idea