apachesolr_multisitesearch_update_metadata() is called on every cron run, which in turn calls DrupalApacheSolrService->commit(). This is no doubt not an issue if cron is run once an hour at the same time on all sites that share the same index.

We have a standard Aegir setup, which cycles through each of our 600 sites, once a minute, five at a time, and runs cron. This means that a commit is called roughly five times a minute, every minute. This is a huge performance hit on our Solr server, especially given that the call to commit from apachesolr_multisitesearch_update_metadata() does not set the "optimize" flag to FALSE.

The attached patch removes this unnecessary call to commit, and also only runs one of the metadata update/fetch functions (I am assuming the commit was in there in the first place to ensure that the fetched metadata document was the same as the one that had just been sent).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pwolanin’s picture

Is the variable no being set? Looks like it shoudl do this no more than once per 5 minutes.

sdrycroft’s picture

It may run only once per five minutes, or even once per hour, but that's still a problem on a multisite installation.

To put it simply, five sites have their cron function run at say 11:00 (Site 1, Site 2, Site 3, Site 4 and Site 5) each of which have not run cron for over an hour. Each site therefore calls the apachesolr_multisitesearch_update_metadata() function, which results in five commits on the Solr instance. One minute later at 11:01, five more sites have their cron function run (Site 6, Site 7, Site 8, Site 9 and Site 10). Again, each of these five sites haven't run their cron for over an hour, and therefore call apachesolr_multisitesearch_update_metadata() resulting in five more commits... and so on.

Dave Reid’s picture

Priority: Major » Normal
Issue summary: View changes

I agree that the frequency is way too often, especially for a large, production multisite installation where entity types and bundles are not necessarily going to be added very frequently, so it would be nice to be able to increase these intervals. I've committed #2257783: Add variables for metadata update and fetch intervals to the latest 7.x-1.1 release so you can bump these intervals higher easily.