Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Problem with Threaded Socket Server

by sundialsvc4 (Monsignor)
on Aug 19, 2013 at 13:09 UTC ( #1050033=note: print w/ replies, xml ) Need Help??


in reply to Problem with Threaded Socket Server

Adding one more thought (in case I missed it) to BrowserUK’s excellent recommendations here ... (++)x2 ... it is also a very good idea to create a pool of worker-threads whose sole purpose is to wait for an incoming message on a shared queue that they all read, and to carry out that request.   (Usually, having done so, they write a record to an outbound-queue so that it can be sent back to the client, either by the “reader” thread or by another one.)

The number of threads is not-equal to the number of requests that are in process at one time, and so the system never attempts to bite off more than it can chew ... the requests just have to wait in line for a bit, but they do so cheaply.   The overhead of setting-up and tearing-down a process or thread is also greatly reduced.   You can set your watch by how many requests-per-second such a system will be able to churn through, no matter whether its waiting-room is full or empty.


Comment on Re: Problem with Threaded Socket Server

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2014-07-13 22:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (252 votes), past polls