{"id":18973313,"date":"2026-07-23T17:30:09","date_gmt":"2026-07-23T17:30:09","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/performance-issue-cpu-load\/"},"modified":"2026-07-23T17:30:09","modified_gmt":"2026-07-23T17:30:09","slug":"performance-issue-cpu-load","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/performance-issue-cpu-load\/","title":{"rendered":"Performance Issue: CPU Load"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I&#8217;m writing to report a performance issue I&#8217;ve traced in My Calendar that&#8217;s causing serious CPU load on a client site (WordPress on SiteGround, ~77 events, one weekly recurring event ending in 5 weeks).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Symptom<\/strong>: With the plugin active, the homepage (which uses [my_calendar_upcoming]) takes 30-40 seconds to load. Disabling the plugin drops load time to under 1 second. This was severe enough that SiteGround suspended the site for excessive CPU usage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Using Query Monitor, I found that for every event rendered, the plugin runs a nearly identical stack of ~15-20 separate queries, including:<\/strong><\/p>\n\n\n\n<ul>\n<li>mc_get_first_event()<\/li>\n\n\n\n<li>mc_get_categories()<\/li>\n\n\n\n<li>mc_get_category()<\/li>\n\n\n\n<li>mc_get_location()<\/li>\n\n\n\n<li>mc_get_location_post()<\/li>\n\n\n\n<li>mc_check_category_relationships()<\/li>\n\n\n\n<li>Two separate WP_Term_Query calls (mc-location-access and mc-event-access taxonomies)<\/li>\n\n\n\n<li>update_meta_cache() \/ delete_metadata() for _occurrence_overlap<\/li>\n\n\n\n<li>mc_ts(), which runs SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP) fresh for every single event, even though this value is identical across all events in the same request<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">None of these individual queries are slow on their own (0.0001-0.0003s each), but the volume multiplies quickly &#8211; roughly 15-20 queries x 50+ events rendered = 750+ queries per page load. I&#8217;ve confirmed this isn&#8217;t a caching issue on my end: both Memcached (object cache) and SiteGround&#8217;s Dynamic Caching (full-page cache) are active, but since these are raw custom SQL queries against the My Calendar tables rather than calls wrapped in wp_cache_get()\/wp_cache_set(), they bypass object caching entirely.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A few things that stood out as easy wins:<\/p>\n\n\n\n<ol>\n<li>mc_ts() \/ the TIMEDIFF(NOW(), UTC_TIMESTAMP) calculation could be computed once per request and reused, rather than recalculated per event.<\/li>\n\n\n\n<li>mc_get_categories(), mc_get_category(), and mc_get_location() all look like good candidates for wrapping in wp_cache_get()\/wp_cache_set(), since the same categories and locations are being re-fetched repeatedly across events.<\/li>\n\n\n\n<li>The repeated WP_Term_Query calls for access-control taxonomies per event also seem like they could be batched rather than run individually.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">For my part, I&#8217;ve disabled the plugin on the effected website. Hoping this is a helpful report so the fix can be included on the next update. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Stacey<\/p>\n","protected":false},"template":"","class_list":["post-18973313","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18973313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18973313\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18973313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}