magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

magento/magento2#39948: Magento_Persistent performance overhead on non-cart, non-checkout pages

Open KrasnoshchokBohdan opened this issue 5 months ago • 5 comments

  • new QuoteResourceWrapper class that uses direct SQL queries instead of loading the entire quote object, which should improve performance

Description (*)

I decided to test the solution proposed by the author. It turned out that the changes reduced the execution time of CheckExpirePersistentQuoteObserver from ~52ms to less than 1ms. Before image After image So I make this pull request to initiate further discussion.

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes https://github.com/magento/magento2/issues/39948

Manual testing scenarios (*)

  1. Add product to cart (for example from PLP)
  2. Enter PDP with profiler enabled

Questions or comments

Contribution checklist (*)

  • [ ] Pull request has a meaningful description of its purpose
  • [ ] All commits are accompanied by meaningful commit messages
  • [ ] All new or changed code is covered with unit/integration tests (if applicable)
  • [ ] README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • [ ] All automated tests passed successfully (all builds are green)

KrasnoshchokBohdan avatar Jun 06 '25 08:06 KrasnoshchokBohdan

Hi @KrasnoshchokBohdan. Thank you for your contribution! Here are some useful tips on how you can test your changes using Magento test environment. :exclamation: Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s) For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here :information_source: Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation. Join Magento Community Engineering Slack and ask your questions in #github channel.

m2-assistant[bot] avatar Jun 06 '25 08:06 m2-assistant[bot]

@magento run all tests

KrasnoshchokBohdan avatar Jun 06 '25 08:06 KrasnoshchokBohdan

@magento run all tests

KrasnoshchokBohdan avatar Jun 06 '25 14:06 KrasnoshchokBohdan

@magento run Static Tests

KrasnoshchokBohdan avatar Jun 07 '25 07:06 KrasnoshchokBohdan

@magento run Database Compare, Functional Tests B2B, Functional Tests CE, Functional Tests EE, Integration Tests, Magento Health Index, Sample Data Tests B2B, Sample Data Tests CE, Sample Data Tests EE, Semantic Version Checker, Unit Tests, WebAPI Tests

KrasnoshchokBohdan avatar Jun 07 '25 16:06 KrasnoshchokBohdan

@magento run all tests

engcom-Hotel avatar Jul 04 '25 06:07 engcom-Hotel

@magento run all tests

KrasnoshchokBohdan avatar Jul 04 '25 20:07 KrasnoshchokBohdan

@magento run all tests

engcom-Dash avatar Jul 15 '25 10:07 engcom-Dash

@magento run all tests

engcom-Dash avatar Jul 17 '25 08:07 engcom-Dash

@KrasnoshchokBohdan Thank you for contribution & collaboration!

✔️ QA Passsed

Preconditions:

  1. Install fresh 2.4-develop
  2. Install any profiling tool such as php-spx

Steps to reproduce:

  1. Add product to cart from PLP
  2. Go to the PDP page keeping profiler enabled
  3. verified on two different PDP

Before: ❌

39967-Before Screenshot 2025-07-17 at 4 53 37 PM

After: ✔️

39967-after After-2

I observed significant improvement in execution time. Previously, the operation took approximately 42ms-43ms, and after the PR changes, it took 1ms-2ms for CheckExpirePersistentQuoteObserver::execute.

The builds are failed hence moving this PR in Extended Testing.

engcom-Dash avatar Jul 17 '25 11:07 engcom-Dash

@magento run Functional Tests B2B, Functional Tests CE

engcom-Dash avatar Jul 17 '25 11:07 engcom-Dash

The Functional B2B Tests failures in the last two consecutive builds are not consistent. They neither failing because of the code changes done in this PR nor part of this PR.

Build 1: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/39967/9f8d6c4fa147eb34fae7d2ddc8cc3355/Functional/allure-report-b2b/index.html#categories/bdbf199525818fae7a8651db9eafe741

image

Build 2: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/39967/223a2577e7607f816b69bcdc77ec64dd/Functional/allure-report-b2b/index.html#categories/bdbf199525818fae7a8651db9eafe741

image

Hence moving this PR in Merge In Progress.

engcom-Dash avatar Jul 17 '25 13:07 engcom-Dash