I have a local site running Magento 2 Enterprise set up on a Hyper-V virtual machine running Ubuntu 18.04 and Nginx. I've got 4 CPUs and plenty of RAM assigned to the virtual machine.

This same site is running quickly on a remote hosting server, even though the hosting server I'm signed up for is one of the lowest tier services (so it doesn't have a huge amount of resources). Yet the site still runs quickly.

When I'm running this site locally, requirejs takes an unreasonably long time (10+ minutes) to load the JavaScript for a page. Here's an example of how long it's taking to load small JavaScript files. Everything that's being loaded is core Magento (no custom stuff) and most of the JavaScript files are 1-2 KB, with some being under 1 KB. The largest one was 34 KB. I'm using the default Luma theme.

enter image description here

What could be causing these files to load so slowly? Each JavaScript file is tiny, so there's no reason why the page should be hanging for several minutes or more while Magento loads JavaScript files. What could be causing this?

I'm doing development so I don't want to turn on the merge JavaScript option while I'm still in development mode.

  • Additional information request from your local PC. Post on pastebin.com and share the links. RAM size of your MySQL Host server A) complete (not edited) my.cnf or my.ini Text results of: B) SHOW GLOBAL STATUS; after minimum 24 hours UPTIME C) SHOW GLOBAL VARIABLES; D) SHOW FULL PROCESSLIST; E) complete MySQLTuner report AND Optional very helpful information, if available includes - htop OR top OR mytop for most active apps, ulimit -a for a linux/unix list of limits, iostat -xm 5 3 for IOPS by device and core/cpu count, for server workload tuning analysis. Jun 8 '19 at 13:27
  • Would like to help you, need your additional information from MySQL instance. Jun 22 '19 at 23:26
  • @WilsonHauck My apologies; I forgot to update this post. I found a few posts saying that I should enable the config cache, and I originally mistook that with the compiled_config cache, which I did have enabled. When I realized my mistake and enabled the config cache, the problem appears to have gone away. I don't understand why, but now my pages load within a few seconds, instead of the 10+ minutes it was taking before.
    – Ben Rubin
    Jun 24 '19 at 18:56
  • Glad your not waiting 10 minutes any more. Thanks for documenting your resolution. Any chance you could post the URL you used for resolution? Jun 24 '19 at 21:14

We always remember about Cache first. As I see, the Js and css should be loaded from disk cache or from memory cache. So, make sure Magento cache and Browser cache are enabling.

My current laptop hardware: 128GB SSD, 12GB RAM, Ubuntu 18.
Magento 2.3.1 default.

enter image description here

[NOTE] On checkout page, Magento will load a lot of Js files. So, it will be a bit slower.

  • I have to clear the cache a lot because I'm doing development. Even with the cache empty, ten minutes still seems like way too long a time for Magento to load a page.
    – Ben Rubin
    Jun 7 '19 at 19:04
  • Did you use xDebug? Jun 7 '19 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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