nystudio107 / craft-seomatic

SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
https://nystudio107.com/plugins/seomatic
Other
165 stars 69 forks source link

High TTFB impact on initial page loads #221

Closed bfopma closed 6 years ago

bfopma commented 6 years ago

We've used SEOmatic extensively through our Craft 2 projects and are now in the process of completing some of our first Craft 3 sites. While performance testing, I noticed an unusually high TTFB for all site pages--even simple ones. There was an extra ~3s delay on initial page load with subsequent page loads behaving mostly as expected.

I tested by simplifying down to a blank page template and still had a 3s initial load, making me wonder if there was something plugin-related impacting things. After disabling SEOmatic the issue went away; enabling it causes the issue to return.

I've tried devmode on/off and caching on/off. When cached, page load is mostly okay with SEOmatic enabled. When uncached, the page load is very slow (~3-7s), which is atypical versus what we have experienced on other (Craft 2) projects. We have the latest SEOmatic installed (3.1.14).

Any help is appreciated--if this issue should be posted somewhere else, please let me know!

Thanks, Brady

khalwat commented 6 years ago

So if you have devMode on, SEOmatic will only cache things for 30 seconds... and yes, the uncache load times can be a little slow, but primarily because with devMode on, SEOmatic is doing a ton of logging.

See:

https://twitter.com/nystudio107/status/1016463411327193089

However, the times you are noting seem excessively high. The impact I've seen from the performance profiling I've done is with devMode on, typically there is a 300-400ms overhead added by SEOmatic. With devMode off, that should drop to < 40ms

What I'd suggest doing is using the Yii2 Debug Toolbar profiler as discussed here:

https://nystudio107.com/blog/profiling-your-website-with-craft-cms-3s-debug-toolbar

...because SEOmatic will add a bunch of profiling data so you can see exactly where it might be being slow.

So the TL;DR is that yes, with devMode on, SEOmatic adds some overhead, but that goes away in staging/production where devMode is off, but the performance you're seeing is very atypical, it should not be that slow, even with devMode on.

Coysh commented 4 years ago

@khalwat I've started noticing high TTFB with devMode on. See attached profiling screenshot. Looks to me like includeMetaContainers is the culprit - adding 5,000ms. I'm running the site locally on nitro, host machine is a 2.8GH\ i7 Mac with 16GB RAM..

image

khalwat commented 4 years ago

@Coysh it's normal that in local dev, it will add some overhead due to how it works (see above).

5,000ms however would make me think something else is wrong with your local dev environment.

Coysh commented 4 years ago

@khalwat yeah - was expecting an increase, but that seems excessive! Any ideas? The only thing I can think that's effecting it is that enableTemplateCaching is false in the local environment, other than that there aren't any of major local config differences.

khalwat commented 4 years ago

I don't use Nitro, so I don't know. But I do think that is excessively slow; perhaps try to sort out the performance issues with P&T?

khalwat commented 4 years ago

Did you remove this post?

On Sep 17, 2020, at 4:31 AM, Joshua Martin notifications@github.com wrote:

@khalwat We're seeing the same thing. This on an environment with env set to live and devMode is off. We're still seeing on average 1s load times for the includeMetaContainers task.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

jsmrtn commented 4 years ago

I did yeah—as usual we found the answer after I raised the ticket, the latency was in part caused by the server and pulling the SEO image from S3, we moved it local and the issue was much less.

Thanks

Get Outlook for iOShttps://aka.ms/o0ukef


From: Andrew Welch notifications@github.com Sent: Friday, September 18, 2020 12:40:24 AM To: nystudio107/craft-seomatic craft-seomatic@noreply.github.com Cc: Josh Martin josh@Scaramanga.agency; Comment comment@noreply.github.com Subject: Re: [nystudio107/craft-seomatic] High TTFB impact on initial page loads (#221)

Did you remove this post?

On Sep 17, 2020, at 4:31 AM, Joshua Martin notifications@github.com wrote:

@khalwat We're seeing the same thing. This on an environment with env set to live and devMode is off. We're still seeing on average 1s load times for the includeMetaContainers task.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/nystudio107/craft-seomatic/issues/221#issuecomment-694557189, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAM5Z3N54GOFTYHC4ISABFDSGKM6RANCNFSM4FUYJKHA.