Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Handling multiple clients

by ranjan_jajodia (Monk)
on Sep 05, 2004 at 06:16 UTC ( [id://388577]=note: print w/replies, xml ) Need Help??


in reply to Re: Handling multiple clients
in thread Handling multiple clients

hi jalewis2,
I am not much of a perl programmer till now (learning learning...).
But if i were to do it in C, i would have a server process listeneing to the request. Since the main task seems to be data query it would load the data in the memory in the beginning. Upon recieving a request it will call a function which will return after forking a child ( worker) thread, which will do the work and exit. You can maintain the thread count in the server process. I don't think preforking is a good idea as it will keep consuming resource even if there is no work to do.

Replies are listed 'Best First'.
Re^3: Handling multiple clients
by kscaldef (Pilgrim) on Sep 05, 2004 at 21:27 UTC

    Depending on the type of server you are writing, you may not want the expense of forking for each request. There is certainly a movement in OS design to make forking cheap, but you still shouldn't assume it is without cost. If you typically have short sessions that require high performance and low latency, you probably want to prefork children.

    I'm not sure what resources you are worried about the children consuming. COW implementations of forking mean that the children will use only minimal additional memory unless they have to. If the children are simply blocking on a select call, they won't be using any significant amount of CPU either.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-24 17:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found