LCP issue: longer than 2.5s - Speed Index 8.5 s

Hi,

Just wanted to ask about site:

datascientyst.com

No recent changes on the site or config.
Google Console alerted about:

LCP issue: longer than 2.5s (mobile)

Mobile

The site is hosted on Digital Ocean.
Then it’s Cloudflare with:

  • standard cache
  • rocket loader
    and few other options

I’m not sure how to find where is the issue:

  • is it between DO - CF
  • is it CF incorrect setup
  • does the server needs some change
  • site optimization

I guess it might be a mix of all above.

Does CF offer paid analysis/support on this?
Are there any features which can improve the overall performance - from the Pro plans?
Any resources / tutorials /videos from CF on the topic? ( I did search on G but found to many of them - some of which did in the past )

Thank you

Definitely a Backend problem.

Here my analysis:

  1. static file cached: 25ms (served by CF)
  2. static file bypass cache: 147ms (served by DO, proxied through CF)
  3. dynamic initial request (dynamic): 3.5s (served by DO, proxied through CF)

Conclusion:
If Cloudflare while it proxies would be the problem the problem also would occur when serving a static file not from cache. The difference between 2. & 3. (Δ ≈150ms 3,5s = 3,35s) is the time that gets wasted on your origin. I don’t know what exactly you did in your Ghost-Backend or how the site is setup, what hardware it runs on or whatever, but something is very sure bad in the Backend. There must be something that takes long to process.

No, please don’t shoot in your own knee :slight_smile: RocketLoader is just an overall bad option that does not solve problems, but shifts them.

My advise:

  • disable RocketLoader
  • optimize your backend/debug what takes so long to generate the page.
  • think about caching
  • frontend is not optimal, but thats not the culprit here, so your ressources are better invested in finding the problem in the backend. But if you want to optimize it, get rid of all the unnecessary JS - it is causing Renderblocking.
  • Probably you try to do some optimize while you generate HTML? Just guessing on this one.
3 Likes

Wow.

That’s pretty professional and useful analysis.
Thank you very much! Much appreciated !

So this give me clear understanding on the situation and the next steps.

So about the suggestions:

  • disable RocketLoader - DONE
  • optimize your backend/debug what takes so long to generate the page. - In progress - found several things to improve
  • think about caching - DO YOU MEAN CF or the server side
  • frontend is not optimal, … TO BE DONE
  • Probably you try to do some optimize while you generate HTML? Just guessing on this one. - TO CHECK

This are the CF settings for cache.
I found them on the web regarding Ghost and CF.

The server:

2 GiB 1 vCPU 2,000 GiB 50 GiB

I think that server upgrade is needed as well.
DO is not giving indications for problem with resources but their graphs are not very clear for me.

Before cache_everything was used but due to issues with cookies it was stopped.

Few related attempts for improvement related to cache_everything and workers

You’re welcome! That is what this community is all about :slight_smile:

I guess 2 vCores should be better :slight_smile:

Both, if possible.

I don’t have much expirience with Ghost since in my opinion it is not made for scalable applications, but if Ghost does have some nice caching stuff try it out.

For Cache everything. You should set it up like this:

  1. Rule: bypass cache on /ghost/
  2. Rule Cache everything on /*
    Please keep in mind, that if you need cookies on the normal page, they would not work anymore. But seems like your site is logically static, just not technically static, so should be ok.

OffTopic:

In generally if you are able to handle SSGs or JAMStack (with dynamic backend) it might would be a better option for your performance requirements. With both of them you could use Cloudflare Pages which is free and awesome with some really cool devs :wink:
It is always a good option to generate statically and regeenrate it on change.

Also it would be un-hackable and super performant. But just if it is worth the effort for you. I personally would definitely do it, if I would be at the start of a new project and fully-static would be an option.

1 Like

About the cache - it’s setup exactly as you mentioned.

Cookies are needed for the member functionality. There was an idea to use workers for the cookies - but day limits are not enough.

Upgraded on 2 CPUs - interesting is that other 2 similar Ghost sites got much better improvement (Desktop):

  • no comments, cache everything 99 score, 50 posts

  • no members, cache everything 84 score, 600 posts - improved on 98

  • members, cache standard, 60 - 70 score, 240 posts

Will continue to debug

Will check those 2: SSGs or JAMStack

Should this tread be closed or should I post update in several days - then to close it.

Cheers!

P.S. Thanks again for the detailed answer.
My experience with https://community.cloudflare.com/ is great.

Wishing CF to offer VPS services as well. Great experience with them and all services.

Ah I see, then Cache Everything sadly will be no option without an expensive plan which does have “bypass on cookie”

Yes, that would be the alternative.

Please never benchmark on low standards. If you benchmark, never check “Desktop” but actually “Mobile” and even mobile does not have high enough requirements for my taste.

If you rely on members function, full static sadly will be no option for you for the pages you rely on the members function.

Feel free to post if you got some news. This forum is basically an archive of solutions which are directly (or sometimes indirectly) related to Cloudflare so that searching people will find a matching solution to their problem. Also the tread will close automatically in 3 days, after the last post after a solution was accepted.

Tbh I don’t see this comming anytime soon. But there are super cool and good VPS services out there. I personally stuck with netcup. Depending on where you are located at (close to them or not) they might be a good deal. There are many others VPS providers out there aswell.

1 Like

Thank you @M4rt1n for your detailed answers

So far I’ve added:

  • CF workers + Cache everything from CF.
  • one more CPU

The results seems better - For desktop mainly - LCP from 2.4 to 0.8.

Please never benchmark on low standards. If you benchmark, never check “Desktop” but actually “Mobile” and even mobile does not have high enough requirements for my taste.

Will focus on that one. Do you have recommended reading on this topic. I mean something like step by step process.

Mobile is bad:

I think that problem is in the front end because using default Ghost theme looks better:

performance 90

I don’t know from where to start the optimization, what has highest impact. That’s why I’ve asked for resources - for beginners :slight_smile:

Cheers

Actually not, here in the forum I and some other MVPs have posted some lists on what to focus, but I don’t have the posts handy. Reading web.dev is generally good for a in depth understanding on:

  1. how the ranking works
  2. how the different points mean
  3. how to improve the page

GPSI sorts the problems by their impact on the page, which you can see on the length of the red or orange bar next to each of them. Start at the top and click on the small arrow down on the right side on each of them. There are some more details on what exactly is wrong and how it should be.

So point 1-3 are all critical and are all btw JS related.

  1. Reduce unused JavaScript
  2. Renderblocking (99% caused by JS)
  3. Duplicate JS modules

Start eliminating ALL unneeded JS code and try to optimize the needed one. You can defer it, you can implement it via eventListsners (async/passive ones please) and improve loadtime by much by doing so as async/passive functions/events are unlikely renderblocking.

Hope that helps. For everything else, just always rewad the google recommendation and google for what ever it asks you to do.
Basically learning by doing :slight_smile:

1 Like

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