When I do have the “lag out” problem, it’s when I visit to many different pages to quickly. Once the lag out occurs nothing will load on the site for about 30 seconds, then everything loads fine again.
It seems to happen when I visit : https://ringprofit.com/page:3
Then click on the blog post on that page, takes forever to load and seems to crash the site.
So what it ended up being was a plugin called : Related Pages v1.1.4
Yes I turned on debugging to see if I could find the problem. I noticed that when I had the slow down, Related Pages was trying to re-cache the site for some reasons if there were to many requests.
You can change the settings of Related Pages to optimize the cache-hit it produces, but it must necessarily evaluate content to find relations. As @pamtbaau noted though, 7.8 MB worth of images should be considered massive these days. You should definitively optimize their loading by using responsive images, lazily loaded in srcset-attributes.
Finding related pages can be expensive, but resulting list is cached for subsequent request.
I did some testing on this: I created a fresh install of skeleton blog-site and added sleep(10) when Related Pages needed to rebuild the list. I printed now when related list needed to be rebuild, as well as when fetching list from cache.
DaringFireball Style Link : Rebuilding: 2018-07-30 14:10:50
Random Thoughts : Rebuilding: 2018-07-30 14:11:01
London at Night : Rebuilding: 2018-07-30 14:11:12
Focus and Blur : Rebuilding: 2018-07-30 14:11:22
Classic Modern Architecture : Rebuilding: 2018-07-30 14:11:33
Every requested page added 10 secs before ‘Classic Modern Architecture’ was displayed.
Without invalidating the cache, repeat 2:
DaringFireball Style Link : From cache: 2018-07-30 14:14:38
Random Thoughts : From cache: 2018-07-30 14:14:39
London at Night : From cache: 2018-07-30 14:14:39
Focus and Blur : From cache: 2018-07-30 14:14:40
Classic Modern Architecture : From cache: 2018-07-30 14:14:41
No overhead when list of related pages is fetched from cache.
In this test scenario, nothing seems to be wrong with the plugin ‘Related Pages’. The site does not ‘crash’ either. The connection with the server is just swamped by the repeated requests and accumulated overhead of building a list of related pages.
Besides, I think that it is an unlikely scenario that in production a user will hit all related pages and get penalised for being the first to rebuild the related pages list for each and every page requested.
I think this is interrelated to what the plugin must necessarily do to index itself, as well as cache-building from a cold cache. Those results would improve massively if the mechanism for indexing was running on something more advanced than the default filesystem-cache, just like cache in general runs much better when heated up.
Of course, not running it on content will improve performance a lot also.