At Administer > CiviMail > CiviMail Component Settings, there is a setting called 'Enable global server wide lock for CiviMail'. What does it do? When it is a good idea for a site to have it and when it is a good idea for a site to have it on?


From the comments in CRM/Core/Lock.php:

   * @param bool $serverWideLock                                                                                                    
   *   Should this lock be applicable across your entire mysql server.                                                              
   *   this is useful if you have multiple sites running on the same                                   
   *   mysql server and you want to limit the number of parallel cron                                  
   *   jobs - CRM-91XX                                                                                 

So basically if you are running multiple civicrm instances on one box and want to limit the number of mailing jobs happening across all instances. This was funded by NYSS and was applicable to their installation.

  • So the lock is put on the ability of an instance to run its mailing queue?
    – Joe Murray
    May 15 '15 at 19:40

From https://issues.civicrm.org/jira/browse/CRM-9153

For multi-sites with a large number of sites (e.g. NYSS with 80 sites), running on a few servers we might want the number of cronjobs processing a mailing to be limited across ALL sites, not across one specific site. Fortunately MySQL locking mechanism is server-wide and we can reuse this, which also means this will not work on sites with multiple MySQL servers. Briefly, we will:

  1. Introduce a global setting that allows the admin to enable server wide locks (false by default)

  2. Modify the core locking code, CRM_Core_Lock to enable calling functions to specific if server wide locks or site specific locks should be used. Site specific locks are the default

  3. Modify the cron script to read this setting and choose the locking mechanism

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.