[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [apache-plusplus] Process model ideas for C++ Apache.
On Thu, 28 May 1998, Michael Anderson wrote:
> If fibers can not be spread across multiple CPUs, isn't there
> a good possibility that a process with many fibers (say 300)
> will be starving many of its fibers since the process is
> competing for CPU (one CPU at a time) with all the other
> processes in the system?
There's another aspect to http requests... they generally don't require a
lot of computing time in userland... most of what they do is tell the
kernel to send some bytes somewhere. The user-level threads packages
generally context switch immediately when a write/read would block. Then
they'll work a bit on another request, and maybe switch again... a bunch
can happen within one kernel context-switch.
As I see it the largest point you're making is in the L1 cache effects of
the increased number of stacks. On x86 this will be really apparent
because the stack is so busy due to a lack of registers.
I really do think we can push static-content stuff into a lightweight pool
of threads like you propose. Most of that amounts to mapping the request
to a file and then shovelling the file out. The "shovelling the file out"
part really only needs to be one thread that does poll()-based work.
Dean