cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.3.0 Product page load time

Re: Magento 2.3.0 Product page load time

It's the following code found in Magento\InventorySales\Model\GetProductSalableQty.php

public function execute(string $sku, int $stockId): float
    {
        $this->validateProductType($sku);
        $stockItemData = $this->getStockItemData->execute($sku, $stockId);
        if (null === $stockItemData || (bool)$stockItemData[GetStockItemDataInterface::IS_SALABLE] === false) {
            return 0;
        }

        $stockItemConfig = $this->getStockItemConfiguration->execute($sku, $stockId);
        $minQty = $stockItemConfig->getMinQty();

        $productQtyInStock = $stockItemData[GetStockItemDataInterface::QUANTITY]
            + $this->getReservationsQuantity->execute($sku, $stockId)
            - $minQty;

        return $productQtyInStock;
    }

Re: Magento 2.3.0 Product page load time

We are using magento 2.3.1 nearly 300k products!

Production Mode, Flat Tables have all been enabled with no change but still product page is join inventory_stock_1 table which is really slow and product page taking too much time to load.

Does anybody have solution to completely remove inventory_stock_1 from join on product page?

Please help!

Re: Magento 2.3.0 Product page load time

This issue still sits in Magento 2.3.1 . We'll have a look at the code and find out what we can do to fix this.

Re: Magento 2.3.0 Product page load time

Hi, Does anyone found solution? We are also experiencing the same issue. In the checkout page also it checks call this function which make checkout slow. We have ~140k products.

 

EDITED:

I found a git hub issue related to this. They have replaced the functionality with triggers. It is one file in the commit. Going to try it.

https://github.com/magento-engcom/msi/pull/2025/commits

Re: Magento 2.3.0 Product page load time

Did you try it? Pls share

Re: Magento 2.3.0 Product page load time

try recreate view using code below: 

CREATE OR REPLACE VIEW inventory_stock_1 AS
  SELECT DISTINCT
    `legacy_stock_status`.`product_id`   AS `product_id`,
    `legacy_stock_status`.`website_id`   AS `website_id`,
    `legacy_stock_status`.`stock_id`     AS `stock_id`,
    `legacy_stock_status`.`qty`          AS `quantity`,
    `legacy_stock_status`.`stock_status` AS `is_salable`,
    `product`.`sku`                      AS `sku`
  FROM (`magento`.`cataloginventory_stock_status` `legacy_stock_status`
    JOIN `magento`.`catalog_product_entity` `product`
      USE INDEX (CATALOG_PRODUCT_ENTITY_SKU)
      ON ((`legacy_stock_status`.`product_id` = `product`.`entity_id`)));

Re: Magento 2.3.0 Product page load time

I was able to fix this issue by adding below code in Magento_Catalog/layout/catalog_product_view_type_simple.xml

 

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
	<referenceBlock name="product.info.simple.extra.catalog_inventory_stockqty_default" remove="true"/>
    </body>
</page>

but after adding this add to cart process is too slow. Adding to cart takes ~8 seconds

Re: Magento 2.3.0 Product page load time

Hi @Alexey Stepanov 

 

Can you provide more details about how to recreate view using code below.

CREATE OR REPLACE VIEW inventory_stock_1 AS
  SELECT DISTINCT
    `legacy_stock_status`.`product_id`   AS `product_id`,
    `legacy_stock_status`.`website_id`   AS `website_id`,
    `legacy_stock_status`.`stock_id`     AS `stock_id`,
    `legacy_stock_status`.`qty`          AS `quantity`,
    `legacy_stock_status`.`stock_status` AS `is_salable`,
    `product`.`sku`                      AS `sku`
  FROM (`magento`.`cataloginventory_stock_status` `legacy_stock_status`
    JOIN `magento`.`catalog_product_entity` `product`
      USE INDEX (CATALOG_PRODUCT_ENTITY_SKU)
      ON ((`legacy_stock_status`.`product_id` = `product`.`entity_id`)));

 

 

Re: Magento 2.3.0 Product page load time

Are you suggesting just to roughly run the query? Thanks

Re: Magento 2.3.0 Product page load time

We have a customer with 1M catalog items, 7K categories, and running on a t3-xlarge w/ RDS t3-med.  Spending time as AWS infrastructure and deployment consultant with them, we isolated the issue of load times to the mega menus they were using.

Then we added Ramjet module for a cache booster, and dropped load times from about 45 seconds to about 1.7 seconds using GTMetrix from W. Canada to UAE.

 

If I had to guess, disable your 3rd-party menus and test and re-test.

 

Other items to check are inventory and shipping. You can turn on the MySQL logging and Profiler to get a great look at the offending modules.

 

Good Luck!

 

~ A