I've had a few sites on my network that have been very slow, and I've determined that deactivating WordPress HTTPS makes them fast again. I've done some debugging and here's what I've found:
* It's generating several hundred queries that look like "SELECT domain FROM wp_blogs" -- to me this looks like a query with a few pieces missing.
* It doesn't appear to relate directly to the number of sites on the network. I'm seeing similar behavior on a network with ~40 sites and one with ~400 sites.
* It DOES appear to correlate with the number of URLs on the page.
* It impacts all pages on a site, not just those which are set to force SSL.
* It slows the page build time down from a fraction of a second to anywhere from 5 to 10 seconds.
Anyone else experienced similar problems? Any suggestions for how to fix it?
My best guess: getLocalDomains is being run hundreds of times, executing this line:
$multisite_hosts = $wpdb->get_col($wpdb->prepare("SELECT domain FROM " . $wpdb->blogs, NULL));
Is the plugin checking every URL on the page? If so, could that query be done once and stored as a private variable in the class?
Thanks for any insight!