|
Hi Beppe,
But I don't understand how the server can know ifand a
there is a worker available or they are all busy
new one should be started and then passed therequest.
Good question.
Personally, I use a spawning server (or INETD) when
I expect to handle
requests that will take a long time. In a
long-running request, the
start-up time is not usually significant, so
pre-starting the workers
isn't much of an issue.
I use pre-started worker jobs only when I expect to
handle requests that
are relatively short, and therefore it's okay to
queue up a few
connection attempts.
I suppose the server could maintain an array of
workers and keep track
of the status of each one. Each time a worker
accepts a new connection,
it notifies the server by sending information via a
socket or pipe.
That give you a scenario very similar to the data
queue you're using
now... the problem with that scenario is it slows
down the speed at
which the server can accept new connections. Which
is why I just use a
spawning server in that scenario, if the accept
speed is going to be
slow ANYWAY, what's the advantage of having a pool
of server jobs?
But, perhaps the data queue approach is the best way
for you, at least
for the time being.
One more question: the worker is in recvmsg.However
if no request arrives within say 30 minutes, itshould
end. Shall I use alarm to set the timeout ?
alarm() or select(), just like any other socket.
--
This is the RPG programming on the AS400 / iSeries
(RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the
archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.