Good morning people!
I come to ask for help with magento 2 configured for multiple stores, my problem is that when I have one or two stores it works normally, but our database has more than 20 stores registered and this causes a very long delay for the first load. Once the store is accessed it gets faster!
I've done several tests, increased the capacity of all services and had no improvements, database and services are optimized. We use instances on AWS EC2, AWS RDS database, AWS CLOUDFRONT CDN and AWS ELASTICACHE REDIS.
When you have one or two stores it takes about 1-2 seconds for the first load, but with all our stores it takes about 15 seconds for the first load.
Does anyone have a solution to speed up this initial loading?
We are using Magento 2.4.2 community.
Are you seeing the slowness at the frontend or the backend of the store?
Do you use any Full Page Cache (FPC) like Varnish or LiteMage Cache?
What Web Server are you using?
Is your MySQL properly tuned, especially relating to the InnoDB buffer pool?
If the slowness is with the frontend only, a Full Page Cache like Varnish should help.
Can you make sure that Varnish is setup correctly within Magento based on the following guide?
https://devdocs.magento.com/guides/v2.4/config-guide/varnish/config-varnish-magento.html