Hi,
I have a system, that has 3 general parts to aid my description.
1) DATABASE- to store all tables, this same database will store data for other services as well including a web application, silverlight etc... (Needs to be flexible, if on a remote server, can be exposed via a web service, if locally, can connect locally or via TCP to the windows service)
2) BLACK BOX - process ONE item at a time by injecting in the list of required items from the database, like a pipe, where u put in a set of conditions, values for a single item, and returns the results for that single processed item.
3) WINDOWS SERVICE- to retrieve data from the database, injects into the black box, saves results from black box to the database at predefined intervals. The service might be sitting on a different server to the database. Will log error and continue should an error occur.
On average, the windows service will have to process about 5000 items, and it will take the black box about 1.5 second to process 5000 items.
My questions are:
a) Should the windows service get a batch list of items to process from the database, or should it get a list of ids, and in a loop get each individual items from the database before passing on to the black box? Note that the same database is being used by other applications as well. Tentatively, I am guessing the database should be a web service call of some sort.
b) Should an individual item be saved immediately after processing? Or should it wait for the batch to finish processing before saving? As saving each individual item after processing is good when the systems suddenly fails in the middle of the process, at least the processed ones are saved, but at the cost of performance due to its 5000 calls to the web service?
Any advice on an optimum solution?
Cheers