workers does not seems to exit when served one client

Eric Wong normalperson at yhbt.net
Tue Nov 3 11:56:27 EST 2009


HaiMing Yin <epaulin at gmail.com> wrote:
> quote from http://unicorn.bogomips.org/:
> 
> {{{
> workers all run within their own isolated address space and only serve
> one client at a time for maximum robustness.
> }}}
> 
> top shows:
> 
> {{{
> 25398 www-data  20   0  268m 137m 3364 S    0  1.7  27:49.41
> unicorn_rails
> 25400 www-data  20   0  266m 135m 3364 S    0  1.7  25:24.31
> unicorn_rails
> 25397 www-data  20   0  265m 134m 3364 S    0  1.7  31:50.72 unicorn_rails
> }}}
> 
> pid are the same since unicorn_rails worker started, and the RES and
> TIME+ column clearly shows that unicorn_rails did not exit after
> served one client.
> 
> What I'm doing wrong?

Hi HaiMing,

You're doing nothing wrong except misunderstanding that phrase.

"one client at a time" means it's not possible to be servicing more
clients than there are worker_processes (the kernel will buffer them).

Basically your workers <=> clients mapping will look like this with
Unicorn:

     unicorn master
     \_ unicorn worker[0]
     |  \_ client[0]
     \_ unicorn worker[1]
     |  \_ client[1]
     \_ unicorn worker[2]
     |  \_ client[2]
     ...
     \_ unicorn worker[M]
        \_ client[M]


Where in other servers (such as Rainbows!) it'll look like this
with multiple clients running under one worker:

     rainbows master
     \_ rainbows worker[0]
     |  \_ client[0,0]
     |  \_ client[0,1]
     |  \_ client[0,2]
     |  ...
     |  \_ client[0,N]
     ...
     \_ rainbows worker[M]
        \_ client[M,0]
        \_ client[M,1]
        \_ client[M,2]
        ...
        \_ client[M,N]

-- 
Eric Wong


More information about the mongrel-unicorn mailing list