AnsweredAssumed Answered

Eliminating long running transactions

Question asked by balazszsoldos on Mar 24, 2010

We are testing Alfresco with huge file transfers, huge folder copy, huge folder deletion and with other transactions like these.

We were suffering from database locks especially on the alf_node table and the alf_usage_delta table. For example when we started file uploads on webdav, ftp and zip import and in the same time we deleted a big folder and also moved an other big folder to a new place we always managed to kill our processes. Sometimes a db lock was done until the zip import was done and the other processes died, sometimes the whole system crashed. (This was in Alfresco 3.0 clustered and MySql but I am not sure we could get better experience with the newer version)

The only solution for our problems were the followings:
- Having single transactions for each file in the case of a huge directory deletion
- Having single transactions for each file in the case of a zip import

These were ok for us as seeing that a deletion or a zip import is partly done is much better than having our server killed.

The directory copy is a bit more tricky as a half done copy does not look nice, so we found out the following solution:
Creating a temp directory on the root spacestore (that is outside company home) and copy the files of the directory there, each in a single transaction. Also the onComplete policies run in single transactions… So a transaction that actually writes record in the database is minimalized.
After everything is done we did a move from the temp folder to the place that it should have been copied. Moving folders seem to be fast independently from the size of the folder.

What we realized that it is important avoid long running transactions that make db table modifications otherwise we get serious problems. I have created this post to let others know what solutions we found and ask others what they think about these solutions (sharing a bit of experience…).