Skip to content

Redis Session locking makes add to cart action very slow and cpu spikes #39824

Open
@ioweb-gr

Description

@ioweb-gr

Preconditions and environment

  • Magento version 2.4.8
  • Use redis sessions and set disable_locking = 0

Steps to reproduce

  1. Create a profile with 10000 simple products in a category
  2. Visit the category
  3. Set pagination to something like 50 so that you can easily do the test
  4. Start adding the products to cart one by one in sequence without waiting

You will notice lots of profile recordings like this

Image

First of all the speed of adding to cart shouldn't be affected so hard.

Secondly as a side-effect, while this is occuring the php-fpm requests are hanging in the CPU occupying fpm children and leading to the cores being fully utilized preventing other operations from occurring.

When this happens in bulk , e.g. from spiders like META, Google , Bytedance etc etc the load on a server can go really high.

Expected result

Add to cart is processed normally

For example if we disable locking

Image

Actual result

The add-to-cart action slows down a lot and especially the more products we have to the cart it increases further

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: CatalogIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Reported on 2.4.8Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    Status

    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions