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

Using QuoteIdToMaskedQuoteId shouldn't increase response time #33676

Closed
5 tasks
ihor-sviziev opened this issue Aug 4, 2021 · 3 comments · Fixed by #33324
Closed
5 tasks

Using QuoteIdToMaskedQuoteId shouldn't increase response time #33676

ihor-sviziev opened this issue Aug 4, 2021 · 3 comments · Fixed by #33324
Assignees
Labels
Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Severity: S1 Affects critical data or functionality and forces users to employ a workaround.

Comments

@ihor-sviziev
Copy link
Contributor

In the Klaviyo extension, we have a plugin that adds a masked quote id to quote search API requests. That looks like quite a small plugin that shouldn't cause any performance damage. But, by just commenting fetching masked quote ID - I noticed that performance is improved more than 2 times.

Here is a link to the plugin in Klaviyo extension (it uses API class, which is ok):
https://github.com/klaviyo/magento2-klaviyo/blob/3.0.5/Plugin/Api/CartSearchRepository.php

Detailed investigation shown that issue is coming from the following line:

public function execute(int $quoteId): string
{
/* Check the quote exists to avoid database constraint issues */
$this->cartRepository->get($quoteId);

Basically, that code fetches again all the quotes again, and all their quote items and so on just for... checking if such quote exists!

Preconditions (*)

  1. Magento 2.3.7 or 2.4-develop

Steps to reproduce (*)

  1. Install Klaviyo extension (tested on version 3.0.5)
  2. Create at least 20 quotes
  3. Run the following code with and w/o Klaviyo extension:
curl --location --request GET 'https://www.mymagento.com/index.php/rest/default/V1/carts/search?searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bfield%5D=updated_at&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bvalue%5D=2021-06-11+11%3A38%3A16&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bcondition_type%5D=gt&searchCriteria%5BsortOrders%5D%5B0%5D%5Bfield%5D=updated_at&searchCriteria%5BsortOrders%5D%5B0%5D%5Bdirection%5D=DESC&searchCriteria%5BcurrentPage%5D=1&searchCriteria%5BpageSize%5D=50' \
--header 'Authorization: Bearer dk6zp483qmck8omd7sov1r3b9is7kxh'

Note: here is documentation on how to get access token https://devdocs.magento.com/guides/v2.4/get-started/authentication/gs-authentication-token.html#request-token

Expected result (*)

  1. You should see approximately the same response time

Actual result (*)

  1. Response time slowed down at least 30% with an enabled module.

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • 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”.
@m2-assistant
Copy link

m2-assistant bot commented Aug 4, 2021

Hi @ihor-sviziev. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

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

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues 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 issues 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

@m2-community-project m2-community-project bot added this to Ready for Confirmation in Issue Confirmation and Triage Board Aug 4, 2021
@ihor-sviziev ihor-sviziev added Severity: S1 Affects critical data or functionality and forces users to employ a workaround. Priority: P2 A defect with this priority could have functionality issues which are not to expectations. labels Aug 4, 2021
@m2-community-project m2-community-project bot added this to Pull Request In Progress in High Priority Backlog Aug 4, 2021
@m2-community-project m2-community-project bot removed this from Ready for Confirmation in Issue Confirmation and Triage Board Aug 4, 2021
@ihor-sviziev
Copy link
Contributor Author

I extracted PR description to the separate issue, and moved here severity & priority labels

@sidolov
Copy link
Contributor

sidolov commented Nov 21, 2021

Hi @ihor-sviziev. Thank you for your report.
The issue has been fixed in #33324 by @ihor-sviziev in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming release.

@sidolov sidolov added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Nov 21, 2021
@sidolov sidolov closed this as completed Nov 21, 2021
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog Nov 21, 2021
@m2-community-project m2-community-project bot moved this from Done to Pull Request In Progress in High Priority Backlog Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
High Priority Backlog
  
Pull Request In Progress
Development

Successfully merging a pull request may close this issue.

2 participants