http://www.perlmonks.org?node_id=1072233


in reply to Re^7: Help designing a threaded service
in thread Help designing a threaded service

Hm. The description was based upon the implementation of nginx server.
The article you linked is factually incorrect (looks to me like a work of some intern from zimbra). Nginx workers don't fight for the accept_mutex after they got events from the listening socket, but they lock this mutex before they subscribe to events from it (see implementation). The reason is to not waste CPU, not to avoid accepting the same connection in different workers, which won't happen even if you disable this option. Anyways, nginx running event loop and OP is seems more interested in traditional prefork options (otherwise he should look at AnyEvent or Mojolicious instead of Net::Server) which simply block in accept, so it is hardly relevant.

PS is it this guy? That's funny

Replies are listed 'Best First'.
Re^9: Help designing a threaded service
by BrowserUk (Patriarch) on Jan 27, 2014 at 21:08 UTC
    The reason is to not waste CPU, not to avoid accepting the same connection in different workers, which won't happen even if you disable this option.

    Hm. I don't how you draw that conclusion from the docs you linked.

    This, "If accept_mutex is enabled, worker processes will accept new connections by turn. Otherwise, all worker processes will be notified about new connections, " very clearly states pretty much the opposite.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      There's a difference between being notified about new connection and accepting it.
        There's a difference between being notified about new connection and accepting it.

        OKay. So all of these identical workers are sitting polling, poll/epoll/select/whatever, and when a new client connects, exactly one of them will come out of the polling with a new client socket in a can read state, and all the others will get a polite note slipped under their doors informing them of the event.

        Do please think before pedanting.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.