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

Use Object Cache for Category Links to avoid redundant calls #29565

Closed

Conversation

lbajsarowicz
Copy link
Contributor

@lbajsarowicz lbajsarowicz commented Aug 15, 2020

Description (*)

Having 52 products in cart, I get 156 requests to the database:
image
This PR goal is to reduce this to 52.

After change, for 26 products:
image

This is a part of #29376 process.

Related Pull Requests

Fixed Issues (if relevant)

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

Manual testing scenarios (*)

N/A

Questions or comments

N/A

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] Use Object Cache for Category Links to avoid redundant calls #29654: Use Object Cache for Category Links to avoid redundant calls

@m2-assistant
Copy link

m2-assistant bot commented Aug 15, 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

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.

@lbajsarowicz seems like your changes broke some functionality, as integration and web api tests are failing. Could you check it?

@ghost ghost moved this from Pending Review to Changes Requested in Pull Requests Dashboard Aug 16, 2020
@ghost ghost assigned ihor-sviziev Aug 16, 2020
@ihor-sviziev ihor-sviziev added Award: bug fix Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Aug 16, 2020
@lbajsarowicz
Copy link
Contributor Author

@magento run WebAPI Tests, Integration Tests

Thanks @ihor-sviziev . Looks like I haven't covered the situation when during a single runtime the data is changed. I just covered that situation by adding Object Cache cleanup method.

@ihor-sviziev ihor-sviziev removed the Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. label Aug 16, 2020
@ihor-sviziev
Copy link
Contributor

@lbajsarowicz integration tests still failing, please review them

@kandy kandy added the Area: Perf/Frontend All tickets related with improving frontend performance. label Aug 17, 2020
@sidolov
Copy link
Contributor

sidolov commented Aug 18, 2020

@lbajsarowicz , @ihor-sviziev it's a good idea to store some values in cache and don't make a lot of requests, such approach can significantly improve performance but I personally like the approach when caching object (in case with interface and preference) or caching plugin is implemented, it will provide ability for developers to disable cache in some extra cases. For example, right now we see several failures of integration tests due to cache, with caching object or plugin we will be able to redefine the preference with object without cache or disable the plugin.

@sidolov sidolov added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Aug 18, 2020
@sidolov
Copy link
Contributor

sidolov commented Aug 18, 2020

@magento create issue

@lbajsarowicz
Copy link
Contributor Author

@sidolov The hell around introducing new classes (including constructor dependencies) and effort to do it in a backwards-compatible manner is too big for "quick fixes" that I'm trying to do (low-hanging fruits).

We should ask one of the teams who don't really care about backwards-compatibility - eg. Security Team, to introduce that the way you ask.

I'm going to improve this approach, as "it does the job it should", but any further work in that area without redesign does not makes sense at all. Look how poor the modified class looks like, and you'd understand why I don't want to play with it more than I need.

@ihor-sviziev
Copy link
Contributor

Hi @lbajsarowicz ,
Will you be able to fix failing tests ?

@lbajsarowicz
Copy link
Contributor Author

@ihor-sviziev I just scheduled that for next weekend.

@ihor-sviziev
Copy link
Contributor

@lbajsarowicz I am closing this PR now due to inactivity.
Please reopen and update if you wish to continue.
Thank you for the collaboration!

@m2-assistant
Copy link

m2-assistant bot commented Sep 16, 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.

@ghost ghost removed this from Changes Requested in Pull Requests Dashboard Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Perf/Frontend All tickets related with improving frontend performance. Award: bug fix Component: Catalog Partner: Blue Acorn iCi partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: needs update Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] Use Object Cache for Category Links to avoid redundant calls
5 participants