Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Problem with Threaded Socket Server

by sundialsvc4 (Abbot)
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?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2020-10-26 05:10 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (250 votes). Check out past polls.