|
I have a socket server that is rather critical to be running 24 x 7. Currently it handles up to 200 connections with no problems. (Never really get over 10 at a time.)
But I want to break this up to the listener and child processes.
The way the communications work is:
Each device connects - sends their data and waits for a response. Once they receive the response they disconnect.
The life of a connection is from 1 to 5 seconds. (There is a 30 second Idle time out on the select that closes all the open idle client connections.)
I use two batch job currently, one that waits at a select() and accepts the connections - Reads the socket from the client and sends the data to a data queue for processing.
The second waits at a data queue and sends the queued data to the first program through a persistent connection.
I am thinking if I use a prestart job as the listener and spawn off 5 child processes, I can then hand off each client connection to the child process and change the child to read the socket - send to data queue - wait for keyed response - write response to socket - close. The child would then wait for another connection to be handed off. I want to be able to spawn additional jobs if 4 of the 5 are in use. (Start another two perhaps.) Change the idle routine to end any extra child processes
I have never created a pre-start job with child processes. Does anyone have an example they can share? In looking at the give and take descriptors it looks simple but how do you spawn without a connection made? This is where I get confused. Can you spawn a new process and later hand off a connection?
Chris Bipes
Director of Information Services
CrossCheck, Inc.
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.