Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^8: Help designing a threaded service

by zwon (Abbot)
on Jan 27, 2014 at 15:14 UTC ( #1072233=note: print w/replies, xml ) Need Help??


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

  • Comment on Re^8: Help designing a threaded service

Replies are listed 'Best First'.
Re^9: Help designing a threaded service
by BrowserUk (Pope) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1072233]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2020-05-26 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (150 votes). Check out past polls.

    Notices?