statamic / cms

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

Big multisite slow down in 4.51.0 and up #10157

Open artisanbarista opened 3 months ago

artisanbarista commented 3 months ago

Bug description

This issue is similar to #9971 and it was introduced in #5502.

When I have updated my multisite with 15 locales and a lot of content the more that 1000+ entries. The performance decreased to 80+ seconds on the first load when using v4.51.0 and up from the 2.5 seconds previous versions prior v4.51.0 did in the first load. (I even updated to statamic v5.4.0 and still the performance issue persists).

NOTE: This slowness happens only in the FIRST load, what I mean by first load:

run: php artisan cache:clear php please stache:warm

and then visit a page. It will take ages to load but after it loads then everything is loading fast as usual, arount 600ms per page.

I have noticed that if I comment this line of code in vendor/statamic/cms/src/Entries/Entry.php line 60 use HasDirtyState; Entry

The issue is fixed in all versions after v4.51.0 and no slowness happens.

How to reproduce

Measure it with v4.50.0 and v4.51.0 or the newest v5.4.0 and see the slowness that happens when HasDirtyState is enabled.

Logs

No response

Environment

Environment
Application Name: Barista
Laravel Version: 10.41.0
PHP Version: 8.1.28
Composer Version: 2.7.6
Environment: local
Debug Mode: ENABLED
URL: barista.com.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: redis
Database: mysql
Logs: stack / single, bugsnag
Mail: log
Queue: sync
Session: file

Statamic
Addons: 3
Antlers: runtime
Stache Watcher: Disabled
Static Caching: Disabled
Version: 4.51.0 PRO

Statamic Addons
jacksleight/statamic-bard-mutator: 2.3.0
jacksleight/statamic-bard-texstyle: 3.1.4
simonhamp/gitamic: 2.2.2

Installation

Existing Laravel app

Additional details

No response

duncanmcclean commented 2 months ago

When I have updated my multisite with 15 locales and a lot of content the more that 1000+ entries. The performance decreased to 80+ seconds on the first load when using v4.51.0 and up from the 2.5 seconds previous versions prior v4.51.0 did in the first load. (I even updated to statamic v5.4.0 and still the performance issue persists).

NOTE: This slowness happens only in the FIRST load, what I mean by first load:

How long did the first load take before updating to 4.51.0?

artisanbarista commented 1 month ago

When I have updated my multisite with 15 locales and a lot of content the more that 1000+ entries. The performance decreased to 80+ seconds on the first load when using v4.51.0 and up from the 2.5 seconds previous versions prior v4.51.0 did in the first load. (I even updated to statamic v5.4.0 and still the performance issue persists). NOTE: This slowness happens only in the FIRST load, what I mean by first load:

How long did the first load take before updating to 4.51.0?

On statamic 4.44.0 the first load is 2.3 seconds.

duncanmcclean commented 1 month ago

Are you able to provide access to the site?