diff --git a/product/CMFActivity/skins/activity/SQLBase_reserveMessageList.zsql b/product/CMFActivity/skins/activity/SQLBase_reserveMessageList.zsql index 246921d3334c29daa6d353abae98af84e2902d8b..1eadf9b804e404a0d0277c4a1d5caa5e89206876 100644 --- a/product/CMFActivity/skins/activity/SQLBase_reserveMessageList.zsql +++ b/product/CMFActivity/skins/activity/SQLBase_reserveMessageList.zsql @@ -25,15 +25,24 @@ WHERE </dtml-if> ORDER BY <dtml-comment> - Explanation of the order by: - - priority must be respected (it is a feature) - - when multiple nodes simultaneously try to fetch activities, they should not - be given the same set of lines as it would cause all minus one to wait for - a write lock (and be ultimately aborted), effectively serializing their - action (so breaking paralellism). - So we must force MySQL to update lines in a random order. + During normal operation, sorting by date (as 2nd criteria) is fairer + for users and reduce the probability to do the same work several times + (think of an object that is modified several times in a short period of time). + However, current implementation is not optimal when reindexing a whole site + with several mount points (to different ZEO servers), because modules may not + be processed in parallel. If you want to speed up ERP5Site_reindexAll, + consider: + - ordering by 'priority, RAND()' temporarily; + - or better, hack ERP5Site_reindexAll so that all reindex messages have + identical/random dates (hint: add optional parameter to Folder_reindexAll + and Folder_reindexObjectList in order to forward a date from + ERP5Site_reindexAll, e.g. current date would work if MySQL + shuffles enough lines with same priority/date). + - or even better, use NEO <http://www.neoppod.org/> + For higher concurrency than 10 or 20 nodes of activity, it might be required + to add a random start point to reduce the risk of MySQL locks. </dtml-comment> - priority, RAND() + priority, date LIMIT <dtml-sqlvar count type="int"> <dtml-var sql_delimiter> COMMIT diff --git a/product/CMFActivity/skins/activity/SQLDict_createMessageTable.zsql b/product/CMFActivity/skins/activity/SQLDict_createMessageTable.zsql index e3b973016b48980f9ac02f7a08df4d8668f694bb..3f65cb8129ab6f436b323557443904b736432725 100644 --- a/product/CMFActivity/skins/activity/SQLDict_createMessageTable.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_createMessageTable.zsql @@ -29,7 +29,7 @@ CREATE TABLE `message` ( KEY (`active_process_uid`), KEY (`method_id`), KEY `processing_node_processing` (`processing_node`, `processing`), - KEY `processing_node_date` (`processing_node`, `date`), + KEY `processing_node_priority_date` (`processing_node`, `priority`, `date`), KEY `serialization_tag_processing_node` (`serialization_tag`, `processing_node`), KEY (`priority`), KEY (`tag`), diff --git a/product/CMFActivity/skins/activity/SQLQueue_createMessageTable.zsql b/product/CMFActivity/skins/activity/SQLQueue_createMessageTable.zsql index 3a9152ab1ed1a89ac8012404b7b20143c220fd38..c359f767809a3646c4b76abd4726cfe57debe3d5 100644 --- a/product/CMFActivity/skins/activity/SQLQueue_createMessageTable.zsql +++ b/product/CMFActivity/skins/activity/SQLQueue_createMessageTable.zsql @@ -28,7 +28,7 @@ CREATE TABLE `message_queue` ( KEY (`active_process_uid`), KEY (`method_id`), KEY `processing_node_processing` (`processing_node`, `processing`), - KEY `processing_node_date` (`processing_node`, `date`), + KEY `processing_node_priority_date` (`processing_node`, `priority`, `date`), KEY `serialization_tag_processing_node` (`serialization_tag`, `processing_node`), KEY (`priority`), KEY (`tag`)