Hope someone can help me with an idea or two on how to approach the following situation;
I currently have a process that generates sequenced files. The sequencing is very important and skipping sequences are not allowed. The applicaton has a single thread that consume data produced buy other threads in the application and this thread is dedicated to file generation and sequecing. When the application encounter a problem it does a rollback and exit. when it restarts it picks up where it left off and everything works fine.
We are starting to experience performance problems though, it simply can't keep up. We need to make the application scalable and I would like to do this by running multiple instances of the application.
My problem is sequencing the files. Everything will work fine so long as no exceptions are encountered, the multiple processes will share a memory area where the sequence will be maintained. But what if one process encounter a problem and exists? When it restart the shared sequence would be have been incremented multiple times.
Can someone suggest an elegant method of approaching this problem?
The application is written in C and is currenty running on TRU64 but will be moved to HPUX early next year.
The sequence number is part of the file name AND contained in the file.
Individual items in the file carry the sequence to allow tying them to the file they arrived in on the remote system following their consumption, loading, and the subsequent destruction of the file.
Basically generate the file without sequence number, then when you know you won't need to rollback (past the point of no return), grab a sequence number and post process.
How are you dividing the work between the processes? And what is the significance of the sequence? Could you have a driver process that assigns a sequence and a range of transactions to the other processes? So if a process aborts, it can be re-executed with the same sequence and range of transactions while the other processes continue with their assigned work.