Magento 2 Configurable product Performance Profiling

Yegor Shytikov
Oct 21, 2020

--

We have a configurable product with 2 configurable options: 2 Size and 46 color variants:

in general, it is 46 * 2 = 92 different product variants. I have a special JSON of the variants. 92 is a color, 380 size attributes.

{"636":{"380":"2493","92":"5156"},"586":{"380":"2494","92":"5156"},"627":{"380":"2493","92":"5159"},"577":{"380":"2494","92":"5159"},"623":{"380":"2493","92":"5162"},"573":{"380":"2494","92":"5162"},"638":{"380":"2493","92":"5165"},"588":{"380":"2494","92":"5165"},"643":{"380":"2493","92":"2532"},"593":{"380":"2494","92":"2532"},"651":{"380":"2493","92":"2614"},"601":{"380":"2494","92":"2614"},"650":{"380":"2493","92":"2624"},"600":{"380":"2494","92":"2624"},"635":{"380":"2493","92":"5171"},"585":{"380":"2494","92":"5171"},"625":{"380":"2493","92":"5132"},"575":{"380":"2494","92":"5132"},"641":{"380":"2493","92":"5174"},"591":{"380":"2494","92":"5174"},"621":{"380":"2493","92":"5177"},"570":{"380":"2494","92":"5177"},"580":{"380":"2494","92":"4941"},"630":{"380":"2493","92":"4941"},"19926":{"380":"2493","92":"5180"},"19866":{"380":"2494","92":"5180"},"637":{"380":"2493","92":"5183"},"587":{"380":"2494","92":"5183"},"652":{"380":"2493","92":"5186"},"602":{"380":"2494","92":"5186"},"645":{"380":"2493","92":"5189"},"595":{"380":"2494","92":"5189"},"646":{"380":"2493","92":"2733"},"596":{"380":"2494","92":"2733"},"626":{"380":"2493","92":"5135"},"576":{"380":"2494","92":"5135"},"656":{"380":"2493","92":"5192"},"606":{"380":"2494","92":"5192"},"619":{"380":"2493","92":"5195"},"568":{"380":"2494","92":"5195"},"639":{"380":"2493","92":"5198"},"589":{"380":"2494","92":"5198"},"647":{"380":"2493","92":"5201"},"597":{"380":"2494","92":"5201"},"648":{"380":"2493","92":"5204"},"598":{"380":"2494","92":"5204"},"618":{"380":"2493","92":"5138"},"567":{"380":"2494","92":"5138"},"634":{"380":"2493","92":"2627"},"584":{"380":"2494","92":"2627"},"657":{"380":"2493","92":"5117"},"607":{"380":"2494","92":"5117"},"605":{"380":"2494","92":"2602"},"642":{"380":"2493","92":"5120"},"592":{"380":"2494","92":"5120"},"19925":{"380":"2493","92":"5123"},"19867":{"380":"2494","92":"5123"},"622":{"380":"2493","92":"5045"},"633":{"380":"2493","92":"5141"},"583":{"380":"2494","92":"5141"},"629":{"380":"2493","92":"5057"},"579":{"380":"2494","92":"5057"},"660":{"380":"2493","92":"2604"},"611":{"380":"2494","92":"2604"},"572":{"380":"2494","92":"5045"},"658":{"380":"2493","92":"5015"},"608":{"380":"2494","92":"5015"},"661":{"380":"2493","92":"5027"},"612":{"380":"2494","92":"5027"},"655":{"380":"2493","92":"2602"},"624":{"380":"2493","92":"2575"},"574":{"380":"2494","92":"5003"},"620":{"380":"2493","92":"5036"},"569":{"380":"2494","92":"5036"},"653":{"380":"2493","92":"5051"},"603":{"380":"2494","92":"5051"},"631":{"380":"2493","92":"5021"},"581":{"380":"2494","92":"5021"},"599":{"380":"2494","92":"5144"},"617":{"380":"2493","92":"5147"},"610":{"380":"2494","92":"5000"},"640":{"380":"2493","92":"5048"},"19865":{"380":"2494","92":"5048"},"604":{"380":"2494","92":"5054"},"654":{"380":"2493","92":"5054"},"578":{"380":"2494","92":"5147"},"628":{"380":"2493","92":"2605"},"649":{"380":"2493","92":"5144"}};

in Magento code it is :

Option code snipet will be there

Related Magento Forum issue:

And as always Magento has performance problems.

Magento does not handle big numbers of associated products efficiently. For example, the price data for each associated product is loaded into one big JavaScript object (JSON). And database queries on the product page are another bottleneck, especially if you use the swatches feature.

Let’s check how Profiling results looks like:

Magento generates 4000 SQL queries to render a single configurable product. Bundle and configurable product features of Magento is completely broken. Yes, it works somehow to declare this feature however it is broken. Sell half baked software it is the main business of Magento and Co.

To fix this issue you need to overwrite Magento frontend and backend from scratch without reusing legacy code lines like Hyva frontend did.

--

--

Yegor Shytikov
Yegor Shytikov

Written by Yegor Shytikov

True Stories about Magento 2. Melting down metal server infrastructure into cloud solutions.

No responses yet