Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: socket server threads or fork

by sundialsvc4 (Abbot)
on Jun 18, 2013 at 17:58 UTC ( #1039618=note: print w/ replies, xml ) Need Help??

in reply to socket server threads or fork

Also, have a look in the CPAN library, and do some serious soul-searching here.   There are many workload-server systems (POE is only one).   You don’t have to start from scratch here.

A principle that you will see in your investigations is that most-often there is not either a thread or a process “per connection,” because that does not scale well.   Instead, when a socket connection is accepted, the request (and socket handle) are handed to a pool of service processes/threads, which remove the request from a queue and process it.   These threads survive to process many requests during their lifetime, and there’s never more than a specified number of them, nor less than another specified number, no matter how many requests are in-process or waiting to be processed at a time.   To prevent flooding, the systems won’t allow the total request-count to grow too large.

“Do not do a thing already done.™”

Comment on Re: socket server threads or fork
Replies are listed 'Best First'.
Re^2: socket server threads or fork
by BrowserUk (Pope) on Jun 18, 2013 at 18:04 UTC


    (A complete socket server using POE? Something that adds two numbers together? Anything?)

    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?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2015-10-06 16:40 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (155 votes), past polls