Hi Everyone!
We have an existing process (running in FIFO order), all business hosts having pool size=1.
Currently we are reading records from a file (one record at a time) then that record goes to business process for further processing and finally through the business operation. As of now we are using synchronous call in our existing code. Before processing the last record we are using hang of 50 seconds because we need to initiate a batch once the processing of last record is finished.
This process is taking too much time for a file having 0.1 million records (max records in a file).
Now we want to increase the performance of this process, so that processing can be faster by modifying the synchronous call with asynchronous call and removing the hang for last record.
While modifying the code, we have met with a condition which counts the processed records and save it in a class using below code
&sql (Select ID into :RowID from Data.A where MetadataID=:MetadataID)
set obj=##class(Data.A).%OpenId(RowID)
set obj.ProcessedCount=obj.ProcessedCount + 1
When the pool size=1, the count was updating correctly but when I tested with pool size=2 or pool size=5, the counts are not getting updated correctly.
I further tried using SQL update but no luck & even tried with %NOLOCK condition if SQLCODE'=0 but that is also not working.
&sql(Update Data.A set ProcessedCount = ProcessedCount + 1 Where ID =:RowID)
if SQLCODE'=0 {
&sql(Update Data.A set ProcessedCount = ProcessedCount + 1 Where ID =:RowID)
}
I believe we cannot use a lock condition before updating ProcessedCount, because it will again process them one by one taking the similar amount of time even with pool size >1
What can be the ideal solution for this issue. Please suggest.
Thanks in advance