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


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.™”

Replies are listed 'Best First'.
Re^2: socket server threads or fork
by BrowserUk (Patriarch) 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.