single threaded web servers
shimi
linux-il at shimi.net
Sun Jul 3 09:33:45 IDT 2016
On Sun, Jul 3, 2016 at 5:13 AM, Amos Shapira <amos.shapira at gmail.com> wrote:
> Yes I know it's possible to fork multiple processes with one thread in
> each and all that jazz.
>
> I'm asking in the context of Erez' response - if he runs single-threaded
> code on a multiprocessor hardware, how would he take advantage of more than
> one processor core?
>
>
It sounds as if from some reason the term 'single threaded' has been used
throughout this discussion while in fact the discussion, IMHO, was actually
about 'event based' as the connection processing mechanism of the servers.
If you replace 'single threaded' with 'events based' and leave the
assumption of 'just a single thread' out (which doesn't necessarily mean
'one thread per connection'), you can then realize that you can use event
based servers... with multiple threads - one per each CPU core, and then
you're not limited to one core's power. Some servers are even smart enough
to figure out the right number automatically....
http://nginx.org/en/docs/ngx_core_module.html#worker_processes (which
happens to be my preferable web server for many years now).
And... you can always "why not write an Nginx module in C?" [1]
-- Shimi
[1] https://www.youtube.com/watch?v=bzkRVzciAZg - please don't take this as
if I agree with every word mentioned there; it's just for the fun of it,
and it's kind of on-topic.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20160703/c72ba58a/attachment.html>
More information about the Linux-il
mailing list