I have a scenario where multiple activities synchronously work together. The commit happens at the end and periodic obj-save are done on clipboard before that.
The parent of this activity is invoked by a Service File which reads one by one from multiple files which have a huge payload in each of them.
What is advised in terms of commit and obj-save in such scenarios to improve performance. Is a final commit for each instance invocation at the end in parent activity called from service file enough, or we do incremental commit at various intervals inside child activities.
***Updated by moderator: Lochan to add Categories***
You have to first answer if there is any logical connection between the pieces. That is, if you have 100 pieces which do 100 saves, if any one fails, do you have to fail all of them? If so, then a single database transaction (with one commit) will take care of the rollback if something fails. Of course, you may exceed the capacity of the database to handle such a large amount of data in one transaction.
If the pieces are independent, then you can choose any commit scheme you want. You now trade off the overhead of each commit vs. losing data from multiple pieces if you commit every N pieces, and 1 of those N fails.
As it depends upon the size of each piece and how annoying it will be to recover the other N-1 pieces in case of a failure, it's really up to you to experiment and decide.