Skip to content

[Performance]Magento 2.3 Performance issue because of huge amount of mysql queries per products in cart #2496

@annakoehler

Description

@annakoehler

We found a server performance problem related to the number of products in cart: the more products in cart, the more mysql requests to the server (see in actual results below). A lot of mysql queries are related to inventory_stock information.We have this issue if Magento_Inventory modules are enabled..
We tested it on both magento 2.3 versions: 2.3.0, 2.3.1 and 2.3.2.
Magento 2.2.x versions don’t have this problem.

Preconditions (*)

  1. Vanila magento CE 2.3.x(composer install) with manually added 10 products via admin
  2. To see mysql requests you need to:
  1. PHP 7.1, PHP 7.2
  2. MYSQL 5.6.38

Steps to reproduce (*)

  1. Add one product to cart
  2. Navigate to checkout and check number of mysql requests in developer toolbar
  3. Add another product to cart
  4. Navigate to checkout/cart and compare number of mysql requests in developer toolbar

Expected result (*)

The number of requests should not change much, in magento 2.2 it was ok, about + 10 mysql requests per product.

Actual result (*)

With one product in cart:
image
With two products in cart:
image
With 10 products in cart:
image

Here are our results:

Qty Mysql queries
1 176
2 253
3 339
4 416
5 493
6 570
7 647
8 724
9 801
10 869

If the Amazon module is activated, an even greater number of requests occur and not only on the checkout page, but on all pages, since it loads the configuration using quote in the isQuoteDirty() function, which generates many mysql requests (Tested on magento 2.3.0)

I duplicated this issue from magento/magento2#22027

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions