Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Improvements #2396

Closed
andjsch opened this issue Sep 10, 2020 · 26 comments
Closed

Performance Improvements #2396

andjsch opened this issue Sep 10, 2020 · 26 comments

Comments

@andjsch
Copy link
Sponsor Contributor

andjsch commented Sep 10, 2020

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
Copy link
Sponsor Contributor Author

andjsch commented Sep 10, 2020

The file watcher is disabled on all sites btw

@jackmcdade
Copy link
Member

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

@jasonvarga
Copy link
Member

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
Copy link
Sponsor Contributor Author

andjsch commented Sep 10, 2020

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

  • Blog
  • Questions
  • Customer reviews
  • Persons
  • Pages

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
Copy link
Member

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

@andjsch
Copy link
Sponsor Contributor Author

andjsch commented Sep 10, 2020

Done!

@tao
Copy link
Contributor

tao commented Sep 14, 2020

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
Copy link
Sponsor Contributor Author

andjsch commented Sep 14, 2020

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
Copy link
Contributor

tao commented Sep 14, 2020

This issue might be related as we've mentioned slow page loads before: statamic/ssg#16

@andjsch
Copy link
Sponsor Contributor Author

andjsch commented Sep 14, 2020

That would make sense!

@jasonvarga
Copy link
Member

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
Copy link
Contributor

tao commented Sep 14, 2020

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
Copy link
Member

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
Copy link
Sponsor Contributor Author

andjsch commented Sep 14, 2020

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
Copy link
Sponsor Contributor Author

andjsch commented Sep 14, 2020

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
Copy link
Member

Oh yeah debug bar definitely adds overhead.

@tao
Copy link
Contributor

tao commented Sep 14, 2020

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 statamic/ssg#24

@jasonvarga
Copy link
Member

Awesome, thanks.

@andjsch
Copy link
Sponsor Contributor Author

andjsch commented Sep 16, 2020

@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
Copy link
Contributor

tao commented Sep 18, 2020

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
Copy link
Member

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

@tao
Copy link
Contributor

tao commented Sep 21, 2020

@jasonvarga I'll send one through later today.

jasonvarga added a commit that referenced this issue Sep 23, 2020
Rather than extend the collection tag that does a bunch of extra queries (like excluding drafts etc)
we'll just do simple queries here which is faster. You pass ids/uris into the tag, that's what you get.

If you need to be filtering, you can use the collection tag.

Ref #2396
@jasonvarga
Copy link
Member

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
Copy link

@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
Copy link
Member

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

@tao
Copy link
Contributor

tao commented Jan 10, 2022

@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.

@jackmcdade jackmcdade changed the title Insane performance issues Performance Improvements Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants