-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
GraphQl Config (SchemaStiching) does not use LockGuardedCacheLoader (Expensive and large config) #39494
Comments
Hi @steven-hoffman-jomashop. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
Hi @engcom-Hotel. Thank you for working on this issue.
|
Hello @steven-hoffman-jomashop, Thanks for the report and collaboration! We have tried to reproduce the issue in the latest development branch i.e. 2.4-develop by adding logger in the below class: magento2/lib/internal/Magento/Framework/GraphQlSchemaStitching/Common/Reader.php Lines 37 to 44 in 56463d5
We used the below script to send the multiple GraphQL requests: Curl-PHP Script$multiCurl = [];$responses = []; $mh = curl_multi_init(); for ($i = 0; $i < $totalRequests; $i++) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'BASE_URL/graphql'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Accept-Encoding: gzip, deflate, br', 'Content-Type: application/json', 'Accept: application/json', 'Connection: keep-alive', 'Origin: chrome-extension://flnheeellpciglgpaodhkhmapeljopja', ]); curl_setopt($ch, CURLOPT_POSTFIELDS, '{"query":"{\n products(search: \"Simple 1\", pageSize: 2) {\n total_count\n items {\n name\n sku\n price_range {\n minimum_price {\n regular_price {\n value\n currency\n }\n }\n }\n }\n page_info {\n page_size\n current_page\n }\n }\n}","variables":{}}');
} do { foreach ($multiCurl as $i => $ch) { As per the script we have sent 100 simultaneous requests and it logs 40 times in the logger file. Are you talking about the same behaviour or please tell us if we have missed anything. Thanks |
I think that seems to be an alternative way to reproduce.
So here we have the GQL schema stitching being performed 40 times for 100 requests. (After a cache flush I assume). |
Hello @steven-hoffman-jomashop, Thank you for the confirmation! We are confirming this issue for further processing. If you have a fix for this issue, we encourage you to create a community PR. We will gladly review and process the PR further. Thanks |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-13605 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue. |
Preconditions and environment
Code on 2.4.8-beta1 shows no use of LockGuardedCacheLoader for GraphQl Config Data.
See GraphQl di.xml
For uses see:
This can lead to a 'stampede' type issue for the expensive schema stitching process. By using the LockGuardedCacheLoader, we can prevent this issue when the cache is flushed.
Other notes:
Steps to reproduce
Expected result
GraphQl schema stitching is only loaded once. (Or F times where F is some small fraction of N; this would mitigate against one process failing).
Actual result
GraphQl schema stitching is run once per request.
Additional information
You can see this effect by monitoring Redis
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: