statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
4.06k stars 530 forks source link

Performance Improvements #2396

Closed andjsch closed 4 years ago

andjsch commented 4 years ago

Bug Description

I do get insane load times in development. Especially with multisite being enabled. No addons installed.

Example site 1 with multisite (2 locales): image

Example site 2 with multisite (7 locales): image

Example site 3 without multisite: image

To me it seems the more locales present, the worse the performance. With static caching enabled in production, it isn't a problem. But it's a huge downside for developing.

Environment

Statamic 3.0.7 Pro Laravel 7.28.1 PHP 7.4.10 No addons installed

andjsch commented 4 years ago

The file watcher is disabled on all sites btw

jackmcdade commented 4 years ago

Can you share more information about the site? Number of collections, number of entries, etc?

jasonvarga commented 4 years ago

And development environment.

And if the load times are as crazy if the template and layout is empty. (i.e. Is it just visiting the url that's the problem, or something within your view that is causing the load time)

andjsch commented 4 years ago

Size of the site (divide by 7 to get entries per locale). This is site 2 with the biggest performance problems. image


Dev environment is a Macbook Pro 15 inch from 2018. Using Laravel Valet. If you want to, I can send a ZIP file with the site towards you if that's of interest.

But in general I can confirm: the bigger the view, the longer it takes to load.

jasonvarga commented 4 years ago

Sure, zip it up and send it to support@statamic.com

andjsch commented 4 years ago

Done!

tao commented 4 years ago

Screenshot 2020-09-14 at 13 19 55

I'm also experiencing a similar problem, I have 17 locales and more than 8000+ collection entries. However, I've been setting my application caching strategy to half which brings page re-loads down to ~150ms... but still difficult to develop on when you make changes and have to wait a while for the pages to reload.

andjsch commented 4 years ago

Caching helps indeed. But I have disabled it locally as I don't want the cache to be active in my dev environment. Hope we will be hearing back soon from the gents. It's a huge problem which will be addressed soon, hopefully.

tao commented 4 years ago

This issue might be related as we've mentioned slow page loads before: https://github.com/statamic/ssg/issues/16

andjsch commented 4 years ago

That would make sense!

jasonvarga commented 4 years ago

If you have thousands of entries, you're going to at least need to make sure the stache watcher is turned off. https://github.com/statamic/statamic/blob/master/config/statamic/stache.php#L7-L18

tao commented 4 years ago

On my side I have the watcher turned off as we discussed previously #1723, it helps a lot but the page loads still seem to take a while as shown in this issue.

jasonvarga commented 4 years ago

I have Andreas' site and should be looking through that today.

I am curious to know how you're using a site with 17 locales (not that there's really anything wrong with that)

andjsch commented 4 years ago

That sounds amazing! Ping me on Discord or over here if you need any help or further info. I'll be around the whole day.

andjsch commented 4 years ago

BTW. As an added note: disabling the debugbar helps as well improving the performance. In the test site I sent I enabled it as I tried to get a clue on where the problem was.

jasonvarga commented 4 years ago

Oh yeah debug bar definitely adds overhead.

tao commented 4 years ago

We're running a publishing (book) website with content going back to the 1970s, and it's been translated into many languages over the years. The large number of collection entries comes from a personal journal by the organisation that covers their daily life going back to the 2005. The large number of entries is also why I've created this pull request to improve the speed on SSG https://github.com/statamic/ssg/pull/24

jasonvarga commented 4 years ago

Awesome, thanks.

andjsch commented 4 years ago

@jasonvarga gave me a decent workaround today. It seems, as of now, that the nav tag is quite a bottleneck. To work around that, we can wrap our nav and footer partial within cache tags like this:

{{ cache scope="page" }}
   everything that's in the nav partial
{{ /cache }}

As _footer.antlers.html won't change per page, we can exclude the scope parameter:

{{ cache }}
everything that already in the file
{{ /cache }}
tao commented 4 years ago

It helps caching the navs but I'm still experiencing a delay just parsing a collection tag.

My donations page for instance takes 20s to load. Caching the header and footer reduces this to around 14s page load time. Caching the collection tag (3 entries) reduces the time by 8s further. Page load time is 4s.

jasonvarga commented 4 years ago

@tao any chance you could send us a zip of your site to support@statamic.com ?

tao commented 4 years ago

@jasonvarga I'll send one through later today.

jasonvarga commented 4 years ago

Closing this as it's just really generic and would probably sit open forever. We can open specific issues for individual items. Or, give https://statamic.com/support a shout.

ceesvanegmond commented 2 years ago

@tao Is this something that is really fixed now? Or did you use the cache workaround? Having the same issues as you with latest statamic. The augmention seems to be the problem which causes it to be slow (nav is using augmention as well).

@jasonvarga

jasonvarga commented 2 years ago

I didn't say it was fixed. There are a number of PRs open regarding performance improvements.

tao commented 2 years ago

@ceesvanegmond Our performance has improved a lot, I think we're down to sub 3s on most pages on the dev website... I believe @jasonvarga helped us figure this out and it was related to assets on S3, specifically audio files. Our site is live now and we're happy with the way it's working, although we don't use any augmentation so your issue might be more specific.