Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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
Re^2: socket server threads or fork
by BrowserUk (Pope) on Jun 18, 2013 at 18:04 UTC

    Code?

    (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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2015-07-06 03:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls