|
From: Donal K. F. <don...@ma...> - 2008-08-29 09:24:14
|
miguel sofer wrote: > Scenario: webserver on a multicore cpu, one-coroutine-per-session. Ie, maintain > session state in the coro's local vars (as opposed to hitting a database or > something equivalent). > > The way it is today, you may run as many threads as you have cores (or a bit > more), and allocate user sessions to the threads on creation in order to balance > the load. But once created, a session has to be resumed in the same thread each > time a new request comes in. > > If the coros could be resumed in any thread, you could balance your load > dynamically - each time a request comes in. This is only valuable when you are running a workload where the service cost of a single session varies widely. If the cost of serving a single client is fairly uniform, you get good enough load balancing from just using a thread pool. The down-side of relocating things across threads is that it makes memory management *much* nastier, and introduces a whole bunch of hot global locks. Don't go there, please! Donal. |