Skip to content

Skip quote item processing in cart graphql to improve loadtime of cart graphql query and save CPU/RAM for other processes #40387

@senthilengg

Description

@senthilengg

Summary

Version : 2.4.x

Cart GraphQl suppose to load only cart object (quote table) without items if it’s not requested as part of request params.

Right now unnecessarily Magento seems to be loading items from quote_item table (and further N+1 and Eav calls) even though it’s not present in the graphql query.

Expected Result

QuoteGraphQl --> cart Query to retrieve data only from Quote table without loading items and its product details

Examples

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php#L87 << Quote Graphql calls repository here >>

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Quote/Model/QuoteRepository.php#L160C20-L160C34 << Quote Repository calls LoadHandler >>

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Quote/Model/QuoteRepository/LoadHandler.php#L46 << LoadHandler calls allVisibleItems >>

Benefits

  1. Major performance and load time benefit for simplified cart query
  2. Less no. of calls to Eav

Proposed solution

Based on request params in graphql query skip loading items objects and its product eav

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Ready for Confirmation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions