[4.x]: Lots of events triggered for every admin page
What happened?
Description
I encountered this problem following the upgrade to Craft 4.
Please refer to the attached file for event counts in Craft 3 and Craft 4.
34K+ events triggered on Craft 4. I've observed duplicate events associated with custom fields (see the attach).
Note: We have integrated over 300 sections and more than 190 fields across 38 sites, each supporting multiple languages.
Steps to reproduce
- Following the upgrade from Craft 3 to Craft 4, there was an increase in the event count.
Craft CMS version
Craft Pro 4.5.11.1
PHP version
8.1.26
Operating system and version
Linux 5.15.0-89-generic
Database type and version
MySQL 47
Image driver and version
GD 8.1.26
Installed plugins and versions
- Amazon S3 2.0.3
- AsyncQueue 3.1.0
- Cloner 2.0.4
- Control Panel Body Classes 2.3.0
- Default Dashboard 2.0.1
- Device Detect 2.0.1
- Feed Me 5.2.0
- Fetch 2.0.0-beta.1
- Formie 2.0.42
- GeoMate 2.1.1
- Maps 4.0.4
- Password Policy 4.1.0
- Redactor 3.0.4
- SEOmatic 4.0.33
- Site Switcher 2.3.0
- Sprig 2.7.2
- Typed link field 2.1.5
- Workflow 2.0.6
Hi, thanks for getting in touch!
I set up a Craft 3 (v3.9.6) project with 2 sites, one of each built-in field type, one channel, one structure and one single section (no plugins), and I migrated a copy of it to Craft 4 (v4.5.11.1). Based on that test, I see a 1.42 to 1.73 increase in the number of events in Craft 4 compared to Craft 3 (depending on which Control Panel page I’m on).
Based on your screenshots, you see a 4.13 times increase on the entries index page.
As a starting point, it would be a good idea if you could disable all the plugins in your Craft 3 and 4 projects (you can do that via a command line: craft plugin/disable --all) and check the difference in the number of events on the same page between the two versions?
@i-just I've already performed this. There are no changes in the event count, with or without plugins.
Thanks for confirming!
Do you use any custom modules for that project? If yes, does the number of events decrease if you comment out the bootstrap array in config/app.php?
@i-just Disabled the custom module and cleared the cache. Still, 32k+ events trigger.
Could you create around 10 sites, 10+ sections, and 100 custom fields in your setup?
Thank you.
Thanks @karthikkstar. I can see that in your last screenshot, you’re on the utilities/system-report page and that the plugins are enabled, but I assume you’ve done this test with both plugins and modules disabled and on the entries index page?
While testing, I have created instances with a lot of sites, sections, fields and entry types, and in all my testing for the same project, the difference in the number of events on the entries index page is always between 1.4 and 1.8 times compared to v3, and that doesn’t even come close to the over 4 times increase that you’re seeing.
Any chance you could send your composer.json, composer.lock and database export for both the v3 and v4 versions of this project to [email protected] so that we can have a deeper look into what’s going on and try to get to the bottom of it?
@i-just Yes, I did disable plugins and modules.Every admin page has 34k+ events, and I checked the entries index page.
The total DB size is 45GB+. I can't share the database without client permission.
Thanks for confirming! How about the composer.json, composer.lock and the config/project directory for both v3 and v4? Would you be able to send that over?
@i-just I have emailed you.
@i-just Still, we experience the slow issue on the admin pages. When multiple users access the admin panel at the same time.