Fix Magento 2 Porto/Pearl/Fastest Theme performance

Yegor Shytikov
Oct 19, 2020 · 4 min read

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 :

Image for post

New Relic Trace:

Image for post

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:

  1. Remove Magento and build normal software using the modern tech stack
  2. REmove Extension
  3. Fix Extension to use less SQL
  4. Fix MSI cache Magento issues
  5. Cache this block with this layout snippet:
<referenceContainer name=”page.top”>
<block class=”Smartwave\Megamenu\Block\Topmenu” name=”sw.topnav” template=”Smartwave_Megamenu::topmenu.phtml” before=”-”>
<arguments>
<argument name=”cache_lifetime” xsi:type=”number”>3600</argument>
</arguments>
</block>
</referenceContainer>

AWS MYSQL RDS CPU utilization after the fix:

Image for post

Also, Porto Theme has another extension:

Mega Plaza layered Navigation:

Mageplaza\Core\Helper:AbstractData::versionCompare

which is a wrapper for

Magento/Framework/App/ProductMetadata:getVersion

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

Image for post

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 <project_root>/var/log/profiler.csv. The profiler.csv will be overridden on each page refresh.

To disable the profiler and remove the flagfile:

  • bin/magento dev:profiler:disable

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

Image for post

Tideways Shows only Bottlenecks/Slow timeline parts:

Image for post

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.

The Startup

Medium's largest active publication, followed by +752K people. Follow to join our community.

Yegor Shytikov

Written by

Magento/APP Cloud Architect. Melting metal server infrastructure into cloud solutions.

The Startup

Medium's largest active publication, followed by +752K people. Follow to join our community.

Yegor Shytikov

Written by

Magento/APP Cloud Architect. Melting metal server infrastructure into cloud solutions.

The Startup

Medium's largest active publication, followed by +752K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store