Help with a bit of debugging on a Ghost blog that freezes

If you’re looking for some help, it’s important to provide as much context as possible so that people are able to assist you. Try to always mention:

  • What’s your URL? This is the easiest way for others to debug your issue:
  • What version of Ghost are you using? Latest / 2.19
  • What configuration? Ubuntu 16.04, nginx, node 8.15.1
  • What browser? Chrome / MacOS
  • What errors or information do you see in the console? Don’t see much, but also don’t know how and where to look more precisely
  • What steps could someone else take to reproduce the issue you’re having? Just load the site, scroll around and then try to open one of the articles on the front page. The site will freeze momentarily (CPU gets high) and after a few seconds it will become responsive again.

Basically I have a former Blogspot blog of a friend of mine that’s been imported into Wordpress and then imported into Ghost. I had these freezes on the Blogspot site as well and I assume it’s something about the content (some embed that’s hanging/freezing) rather than an issue with Ghost itself (not having this kind of behavior in other sites running on Ghost on the same server and with the same config).

If someone has a couple of minutes to check the performance tab of the console (I recorded a snapshot and saw a YouTube video that looked suspicious but I wasn’t able to identify the culprit) and if I could get a hint on where to look it would be hugely appreciated.


Bumping this by also adding a Google PageSpeed Insights screenshot with a .js file that takes forever to load:

It seems to be /content/themes/nubia/assets/js/app.min.js minified that is 10x bigger than app.js and takes forever to evaluate.

@dsecareanu taking a very quick look, I think the search functionality may be a culprit - the way you currently have it implemented it’s loading every single post (444!) from the Content API and generating a search index on every page load. The search index generation is taking ~10sec on my laptop and locks the main thread.

I’d look into an alternative search implementation, or at least modify it’s behaviour so the content load and index generation only happens when the search modal is activated so it’s behaviour-driven rather than occurring on each page load.

Thanks a lot @Kevin!

I will take this with the theme developer and see if we can solve it some way (part of the issue is also most probably caused by the size of images/gif’s in each post, meaning that it tries to handle around 300mb of content on every query).

The problem is your search. ghostHunter, the search library that you are using, fetches all posts, including the post content. That means 444 posts are loaded on refresh.

I really recommend you the open source search library that we made because you can specify to get only the title, url, reponsive image, pretty much what you need. So you’ll not have such a heavy loading on refresh. You can also make the library to get the posts when the user clicks on search input, not on page load.

You can see more about the library in this topic:

Feel free to ask any questions if you have.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.