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

[Performance] GraphQL cache issue #38668

Open
1 of 5 tasks
Nuranto opened this issue Apr 26, 2024 · 17 comments
Open
1 of 5 tasks

[Performance] GraphQL cache issue #38668

Nuranto opened this issue Apr 26, 2024 · 17 comments
Labels
Area: Upgrades - Upgrade Compatibility Tool Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Reported on 2.4.7 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@Nuranto
Copy link
Contributor

Nuranto commented Apr 26, 2024

Preconditions and environment

  • Magento version 2.4.7
  • I have that issue on hyva react checkout. So to reproduce the issue, I'll use a small script in steps :

(A)
pub/graphql-cache-test.php

<?php
/**
 * Public alias for the application entry point
 *
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

use Magento\Framework\App\Bootstrap;

try {
    require __DIR__ . '/../app/bootstrap.php';
} catch (\Exception $e) {
    echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
    <div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
        <h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
        Autoload error</h3>
    </div>
    <p>{$e->getMessage()}</p>
</div>
HTML;
    http_response_code(500);
    exit(1);
}

$bootstrap = Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);

$graphqlCache = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\GraphQl\Config\Data::class);

(B)
in Magento\Framework\Config\Data

protected function initData()
    {
        $data = $this->cache->load($this->cacheId);
        if (false === $data) {
            // add debug
            \Magento\Framework\App\ObjectManager::getInstance()
            ->get('Psr\Log\LoggerInterface')->debug("CACHE {$this->cacheId} MISS");
            $data = $this->reader->read();
            $this->cache->save($this->serializer->serialize($data), $this->cacheId, $this->cacheTags);
        } else {
            // add debug
            \Magento\Framework\App\ObjectManager::getInstance()
            ->get('Psr\Log\LoggerInterface')->debug("CACHE {$this->cacheId} HIT");
            $data = $this->serializer->unserialize($data);
        }

        $this->merge($data);
    }

Steps to reproduce

  1. Upgrade Magento from 2.4.6-p4 to 2.4.7
  2. Make a script to test graphql cache (A)
  3. Add debug to monitor cache HIT/MISS (B)
  4. purge cache
  5. run script multiple times

Expected result

  • CACHE [prefix]_MAGENTO_FRAMEWORK_GRAPHQLSCHEMASTITCHING_CONFIG_DATA MISS
  • CACHE [prefix]_MAGENTO_FRAMEWORK_GRAPHQLSCHEMASTITCHING_CONFIG_DATA HIT
  • CACHE [prefix]_MAGENTO_FRAMEWORK_GRAPHQLSCHEMASTITCHING_CONFIG_DATA HIT
  • CACHE [prefix]_MAGENTO_FRAMEWORK_GRAPHQLSCHEMASTITCHING_CONFIG_DATA HIT
  • CACHE [prefix]_MAGENTO_FRAMEWORK_GRAPHQLSCHEMASTITCHING_CONFIG_DATA HIT

Actual result

  • CACHE [prefix]_MAGENTO_FRAMEWORK_GRAPHQLSCHEMASTITCHING_CONFIG_DATA MISS
  • CACHE [prefix]_MAGENTO_FRAMEWORK_GRAPHQLSCHEMASTITCHING_CONFIG_DATA MISS
  • CACHE [prefix]_MAGENTO_FRAMEWORK_GRAPHQLSCHEMASTITCHING_CONFIG_DATA MISS
  • CACHE [prefix]_MAGENTO_FRAMEWORK_GRAPHQLSCHEMASTITCHING_CONFIG_DATA MISS
  • CACHE [prefix]_MAGENTO_FRAMEWORK_GRAPHQLSCHEMASTITCHING_CONFIG_DATA MISS

Additional information

  • This issue cause every actions on our checkout to take almost 10sec.
  • It seems it only happens when use_lua = 1 (which became the default value in 2.4.7)
  • Quick workaround = set use_lua = 0 in backend options

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”.
Copy link

m2-assistant bot commented Apr 26, 2024

Hi @Nuranto. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ 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, join the Community Contributions Triage session to discuss the appropriate ticket.

@engcom-Delta engcom-Delta added Reported on 2.4.7 Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it labels Apr 26, 2024
@engcom-November engcom-November self-assigned this Apr 29, 2024
Copy link

m2-assistant bot commented Apr 29, 2024

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-November
Copy link
Contributor

Hello @Nuranto,

Thank you for the report and collaboration!

Tried to reproduce this on 2.4-develop and 2.4.7 instance, in our case it is not reproducible.
Steps to reproduce followed are same as in description.
But we got the expected result:

CACHE Magento_Framework_GraphQlSchemaStitching_Config_Data MISS [] []
CACHE Magento_Framework_GraphQlSchemaStitching_Config_Data HIT [] []
CACHE Magento_Framework_GraphQlSchemaStitching_Config_Data HIT [] []
CACHE Magento_Framework_GraphQlSchemaStitching_Config_Data HIT [] []
CACHE Magento_Framework_GraphQlSchemaStitching_Config_Data HIT [] []

Please let us know if we are missing anything.
Thank you.

@engcom-November engcom-November added the Issue: needs update Additional information is require, waiting for response label Apr 29, 2024
@Nuranto
Copy link
Contributor Author

Nuranto commented Apr 29, 2024

Then I guess it is related to the content of the cache. Maybe the size of it, or some special characters or sequence of characters....
Anyway, I have no idea how to create reproductible steps without spending a lot of time into it.

@engcom-November
Copy link
Contributor

@Nuranto, are there any prerequisites like magento should be configured with redis cache?

@Nuranto
Copy link
Contributor Author

Nuranto commented May 2, 2024

Yes indeed, the issue only happens when cache is configured to redis with use_lua set to 1 (or not set at all, since use_lua is set to 1 by default)

@engcom-November
Copy link
Contributor

@Nuranto, configured magento 2.4.7 instance with redis and ran the script, but we still got the Expected result.

@Nuranto
Copy link
Contributor Author

Nuranto commented May 3, 2024

It's probably related to the cache content itself then. But as you can see here, it seems there's multiple issues when use_lua = 1 : colinmollenhour/Cm_Cache_Backend_Redis#181
Maybe we should at least disable this parameter by default.

Copy link

m2-assistant bot commented May 16, 2024

Hi @engcom-Hotel. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Hotel
Copy link
Contributor

Hello @Nuranto,

I agree with your point and have also gone through the issue mentioned here #38668 (comment).

But as we can see while setting up the Redis in Magento 2 the use_lua value is by default set to false. Please have a look at the below screenshot:

image

Please let us know in case we have missed anything.

Thanks

@Nuranto
Copy link
Contributor Author

Nuranto commented May 17, 2024

Alright, in my case there was nothing configured for this field after upgrading.
Anyway, I guess this option should be always disabled if not resolved.

I think we can close this issue since the real issue is located on another lib.

@engcom-Hotel
Copy link
Contributor

Thanks for the feedback @Nuranto.

Can you please let us know from which version you have upgraded your Magento to 2.4.7? This might be an issue related to the upgrade process.

Also please elaborate on the below line:

the real issue is located on another lib.

Thanks

@Nuranto
Copy link
Contributor Author

Nuranto commented May 20, 2024

From 2.4.6-p4

the real issue is located on another lib.

The error happen somewhere in this lib : https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/blob/d403f4473e1b3cc616fa59d187e817543b6620c1/Cm/Cache/Backend/Redis.php#L589-L631

@engcom-Hotel
Copy link
Contributor

Hello @Nuranto,

We have tried to reproduce the issue after upgrading the Magento from 2.4.6-p4 to 2.4.7 and the issue is reproducible for us. We are getting the Actual Result mentioned in the main description.

Please refer to the below screenshot for reference:
image

Hence confirming the issue.

Thanks

@engcom-Hotel engcom-Hotel added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Upgrades - Upgrade Compatibility Tool and removed Issue: needs update Additional information is require, waiting for response labels May 22, 2024
@m2-community-project m2-community-project bot removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label May 22, 2024
@m2-community-project m2-community-project bot added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels May 22, 2024
@engcom-Hotel engcom-Hotel added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label May 22, 2024
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-11998 is successfully created for this GitHub issue.

Copy link

m2-assistant bot commented May 22, 2024

✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@github-jira-sync-bot
Copy link

❌ You don't have permission to export this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Upgrades - Upgrade Compatibility Tool Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Reported on 2.4.7 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Status: Ready for Development
Development

No branches or pull requests

5 participants