Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkout / Sales Rules / Get rid of redundant DB query #29376

Conversation

lbajsarowicz
Copy link
Contributor

@lbajsarowicz lbajsarowicz commented Aug 4, 2020

Description (*)

  • Loading data in the loop?
  • No, thank you!

By replacing direct SQL query with Data Provider that was already used in this Validator class allowed me to drastically reduce the cost of checkout placing process.

Local environment

20 products in cart

image

Custom project

22 products in cart

image

Related Pull Requests

Fixed Issues (if relevant)

Performance of Checkout

Manual testing scenarios (*)

  1. Install sample data
  2. Create Catalog rule based on category
  3. Add plenty of products (15 - inf.)
  4. Place an order.

Enjoy the pleasure of the checkout faster by 20 - 30% (and/or) send me a good whiskey

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)
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] Checkout / Sales Rules / Get rid of redundant DB query #29453: Checkout / Sales Rules / Get rid of redundant DB query

@m2-assistant
Copy link

m2-assistant bot commented Aug 4, 2020

Hi @lbajsarowicz. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ 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

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@lbajsarowicz
Copy link
Contributor Author

@magento run all tests

@ihor-sviziev ihor-sviziev added the Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. label Aug 4, 2020
@ihor-sviziev ihor-sviziev self-assigned this Aug 4, 2020
@ihor-sviziev ihor-sviziev added Award: bug fix Award: category of expertise Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests labels Aug 4, 2020
@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Aug 4, 2020

@slavvka @lenaorobei is there an ability to run performance against 2.4-develop and for this PR? Would be good to check the diff. I think this is the only one way to measure this improvement with automated tests

@IvanChepurnyi
Copy link
Contributor

Nice performance optimization @lbajsarowicz, would be great also to remove the singular query with preloaded category ids into this service by using afterload even on product collection in the shopping cart.

@lbajsarowicz
Copy link
Contributor Author

@magento run Static Tests, Unit Tests

These failed due to implementation testing. SVC has to be approved by Magento crew.

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lbajsarowicz,
Could you implement following suggestion? #29376 (comment)

@ghost ghost moved this from Pending Review to Changes Requested in Pull Requests Dashboard Aug 4, 2020
@lbajsarowicz
Copy link
Contributor Author

lbajsarowicz commented Aug 4, 2020

@ihor-sviziev That is the subject for another PR.
With the delays caused by Product Owners from Adobe, I'd prefer to do it separately.

(This will require a set of additional Integration tests)

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Aug 4, 2020

@lbajsarowicz I don't mind to improve solution with small steps.
@magento run all tests

@ihor-sviziev ihor-sviziev moved this from Changes Requested to Pending Review in Pull Requests Dashboard Aug 4, 2020
ihor-sviziev
ihor-sviziev previously approved these changes Aug 4, 2020
Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔ Approved.

Failing SVC test looks false positive

@ghost ghost moved this from Pending Review to Ready for Testing in Pull Requests Dashboard Aug 4, 2020
@ghost ghost removed the Progress: pending review label Aug 4, 2020
@ghost ghost added the Progress: review label Aug 6, 2020
@ghost ghost moved this from Review in Progress to Ready for Testing in Pull Requests Dashboard Aug 6, 2020
@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-7950 has been created to process this Pull Request

@engcom-Alfa engcom-Alfa moved this from Ready for Testing to Testing in Progress in Pull Requests Dashboard Aug 7, 2020
@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

Manual testing scenario:

  1. Install Magento with sample data
  2. Create Catalog rule based on category
  3. Add plenty of products (50 in my case)
  4. Place an order.

Local environment

Before: ✖️

2020-08-07_14-13

After: ✔️
50 products in cart

Screenshot from 2020-08-07 14-29-24

@engcom-Alfa engcom-Alfa moved this from Testing in Progress to Extended Testing (optional) in Pull Requests Dashboard Aug 7, 2020
@engcom-Charlie engcom-Charlie added the QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) label Aug 7, 2020
@engcom-Alfa
Copy link
Contributor

@magento create issue

@engcom-Alfa engcom-Alfa added QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope and removed QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) labels Aug 11, 2020
@ghost ghost added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Aug 13, 2020
@engcom-Charlie engcom-Charlie moved this from Extended Testing (optional) to Merge in Progress in Pull Requests Dashboard Aug 14, 2020
@magento-engcom-team magento-engcom-team merged commit be1ca7f into magento:2.4-develop Aug 15, 2020
@m2-assistant
Copy link

m2-assistant bot commented Aug 15, 2020

Hi @lbajsarowicz, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Award: bug fix Award: category of expertise Component: Rule Component: SalesRule Partner: Blue Acorn iCi partners-contribution Pull Request is created by Magento Partner Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
Pull Requests Dashboard
  
Recently Merged
Development

Successfully merging this pull request may close these issues.

[Issue] Checkout / Sales Rules / Get rid of redundant DB query
6 participants