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

Re^2: Handling multiple clients

by ranjan_jajodia (Monk)
on Sep 05, 2004 at 06:16 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2023-09-25 09:18 GMT
Find Nodes?
    Voting Booth?

    No recent polls found