Magento 2 itself is a completely broken and slow platform, however, when somebody adding functionality or 3-d party modules to its core it stops working as an eCommerce at all its works as wait commerce.
The entire Magento 2 exosystem is a mess and 3-d part solutions broken. Not because the solution is low, however, because they are using Magento's broken core. In this case, I will show you how the best and most popular Magento Theme can kill your store. And all Certified Verified Shitty Magento Agencies using broken Magento core with 3-d party modules and after your store doesn’t work.
Maybe the theme CSS and HTML are not so bad however Magento when it comes to interaction with Magento cere it is terrible. You can’t build a good platform on the top crapy core. Also, these temes adding not just CSS and HTML they are adding dozen broken Extensions with own JS libraries PHP Helpers, and bad MySQL queries written by junior certified Magento developers. That extensions regularly is the main problem. Sometimes theme package changes Magento core functionality and you are losing simple upgradability.
Always the main problem is a Mega Menu feature/functionality/module. Magento Mega menu generates 500–2000 SQL queries per each page view.
For example Porto Theme:
- 22,472 Sales
- 9,732 Comments
Magento Mega Menu Performance Issue :
New Relic Trace:
you will tell it is not a Magento issue it is the 3-d part issue. No, it is a Magento issue because this block has cache however it doesn't work. Magento 2 has a crapy cache system in MSI block which works with VArnish. basically, Varnis is redundant for your eCommerce store. If Magento Solution/Sales engineer trying to sell varnish instead of eCommerce software it is scum.
To fix this issue you have a choice:
- Remove Magento and build normal software using the modern tech stack
- REmove Extension
- Fix Extension to use less SQL
- Fix MSI cache Magento issues
- Cache this block with this layout snippet:
<block class=”Smartwave\Megamenu\Block\Topmenu” name=”sw.topnav” template=”Smartwave_Megamenu::topmenu.phtml” before=”-”>
<argument name=”cache_lifetime” xsi:type=”number”>3600</argument>
AWS MYSQL RDS CPU utilization after the fix:
Also, Porto Theme has another extension:
Mega Plaza layered Navigation:
which is a wrapper for
This performance issue is especially critical because plugins check the Magento version, this overhead is usually present in all 3-d party modules.
We need to check all methods calls they are really slow because they have a fallback to the file system
Identify Magento Performance Problems:
You need a Profiler. Magento default one works also great. Or you can try
To enable or disable the profiler:
Log in to your Magento server.
Change to your Magento installation directory.
As the Magento file system owner, enter the following command to configure the profiler:
To enable the profiler using type
html and create a flagfile:
bin/magento dev:profiler:enable html
To enable the profiler using type
csvfile and create a flagfile:
bin/magento dev:profiler:enable csvfile
The output will be saved to
profiler.csv will be overridden on each page refresh.
To disable the profiler and remove the flagfile:
This profiler is enough to identify some problem however the best is to use advanced profilers extensions for PHP — BlackFire and Tideways (XHProf from Facebook)
I like Tideway over BlackFire. + Tidaways 30 days free and you can try it. Also, Tideways is a PHP performance monitoring tool, not just a profiler. BlackFire is free just for local development. Also, BlackFire has a Huge timeline
Tideways Shows only Bottlenecks/Slow timeline parts:
Tideways has some missing timeline parts. However enough to allocate performance problems.
How to fix any Magento performance problem
Most of the Magento problem is customizations and 3-d party modules. Magento 2 core also has too many performance issues and we can’t fix that.
To fix 3-d party problems you need just remove those modules. If you need something similar you can rewrite it from scratch with understanding performance problems.