Question

In my application, I need to read data from one socket, do some processing, write it to file, and send it to another socket. The order of the data is important and must be maintained without dropping any of it.

I'm using domains and clustering combined for error handling. A domain will catch the error, exit the current process, and fork a new one. It is possible to have multiple processes running concurrently for load balancing.

I don't believe I have any guarantee or control over how the data is handled between the processes. So, how can I maintain the order of the data flowing as a whole, without losing any should a process catch an exception and exit?

UPDATE:
Example problem: There is a stream of data coming in on a socket. Two concurrent processes each read a chunk of that stream. By random selection, each process has a chance to write its chunk to file. By random selection, each process then has a chance to send its chunk to another socket. There is only one shared incoming socket, one shared file, and one shared outgoing socket. I need to guarantee the order of the data coming in remains the same going to file and out the other socket.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top