1

I've been getting slow page load times on my magento 2.3.1 site. I am still developing it and it is in developer mode, but i dont think switching to production mode will help too much. I have been developing a theme but it was slow before i noticed this and i have set it back to luma for further testing. Redis, varnish cache and elasticsearch 6 were all enabled, i have turned varnish and elasticsearch off but they did not make a difference and i heard that when using magento profiler you should turn off varnish. I am running on a cloudserver with NGINX, PHP-FPM on Ubuntu 18.04. I have allocation of 4 cores and 4GB RAM. I use a plugin that will import most of my stock automatically from product feeds, i am currently using the sample data of just over 6000 products.

This is a link to my magento profiler data https://pastebin.com/SUM0u3aE

This section seems to be part of the issue

· · · TEMPLATE:/var/www/clicksaveandprint.com/shop/vendor/magento/module-customer/view/frontend/templates/account/authentication-popup.phtml 0.001382 0.001382 1 75,552 0 · · · TEMPLATE:/var/www/clicksaveandprint.com/shop/vendor/magento/module-catalog/view/frontend/templates/category/products.phtml 3.264447 3.264447 1 7,530,600 4,194,304 · · · · EVENT:catalog_block_product_list_collection 2.471067 2.471067 1 6,501,048 4,194,304 · · · · · OBSERVER:review 2.471036 2.471036 1 6,499,400 4,194,304 · · · · · · EAV:load_collection 2.466872 2.466872 1 6,363,984 2,097,152

I have not edited the products.phtml. The product pages load better and with varnish on it is acceptable but the category pages are far from ideal.

Can anyone help narrow down the issue?

3
  • 1
    I don't think 4GB RAM enough for magento2 As there is a lot of cron run at Magento. Also, check Magento basic speedup settings.
    – Amit Bera
    Commented May 3, 2019 at 8:57
  • 1
    RAM is not the issue here. 4GB is fine for what i am doing.
    – Alex Smith
    Commented May 3, 2019 at 9:54
  • Did you figure this out. I've heard increasing mysql memory?
    – jstrez77
    Commented May 3, 2019 at 19:55

4 Answers 4

0

Check this also

Checking cache status is the last thing one can think about, but may be this is the case. Sometimes it happens after setup:upgrade as well

1
  • Cache is enabled and working. Neither built-in cache or varnish affect page load times for this issue. Home page, product page etc are all fine
    – Alex Smith
    Commented May 3, 2019 at 9:53
0
  1. Make sure, there are no blocks loading with attribute cacheable=false, it prevents the whole page in full page cache.

  2. There must not be direct use of objectmanager in phtml files.

  3. reduce loading helpers using $this->helper() in phtml files.
  4. make sure there are not any repetitive collection queries not being done in loop or query should be optimised (select * from ..., must not be used).
  5. Production mode (with minified JS/css) will also increase performance.
  6. enable gzip compression
  7. You can use redis and varnish for cache mechanism to improve performance
  8. You can also use CDN
6
  • As i said in my first post, i am currently using the default luma theme to rule out issues with the theme i started building. It is the core magento products.phtml that has not been edited that is the slowest loading file. gzip is enabled. As already mentioned i do use redis and varnsih, but also disabled varnish for testing purposes, even with it turned on it does not help. Will production mode speed up page load times by over 3 seconds?
    – Alex Smith
    Commented May 3, 2019 at 9:51
  • Then production mode (minify js/css, merge css), server configuration like cache static-content, redis / varnish will improve performance. Commented May 3, 2019 at 9:53
  • Did you even read what i just wrote? gzip is enabled, redis and varnish do not help when they are enabled, i disabled them to test various options to work out where the problem lies. Enabling them again still produces slow results.
    – Alex Smith
    Commented May 3, 2019 at 9:55
  • Please follow devdocs.magento.com/guides/v2.0/config-guide/prod/…, if anything remains to configure :) Commented May 3, 2019 at 10:00
  • As expected, enabling production mode does not significantly increase the load time. The last page load i did was 8.5seconds. the product.phtml is still taking over 2 seconds to load. Varnish and Redis is enabled. It appears to be PHP that is using high CPU
    – Alex Smith
    Commented May 3, 2019 at 10:26
0

I managed to fix this. I have no idea whether this was just coincidence or not but i ran "composer dump-autoload -o --apcu" which disabled all caches and then i enabled them all again and the site sprang in to life

1
  • Hi @Alex, I have the same problem that you have with magento 2.3.1, could we talk about the server configuration and the magento configuration you have? Maybe I am doing something wrong in my configuration. I have a server with 8 GB of RAM and 4 cores. And my magento is very slow :( Can you help me please?
    – Despotars
    Commented Nov 12, 2019 at 11:26
0

Enable the profiler and check which query took a long time to execute, once you took the list of the huge query, then proceed with optimizing those areas

Enable Profiler in Magento

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.