This article provides a solution for performance issues with a Magento Commerce or Magento Commerce Cloud site due to some high throughput requests causing significant server load and traffic.
AFFECTED PRODUCTS AND VERSIONS
- Magento Commerce Cloud 2.2.x, 2.3.x
- Magento Commerce 2.2.x, 2.3.x
The issue is fixed in version 2.3.4 of both Magento Commerce Cloud and Magento Commerce.
The site experiences a slow performance due to high throughput requests, like critical AJAX requests.
High throughput AJAX requests include those related to customer private content.
There are three solutions:
- Upgrade to version 2.3.4. If this is not currently possible, install the patch fixing the issue.
- Ensure lighter requests (cache requests or move to customer private content).
- Reduce the number of requests.
Ensure lighter requests (cache requests or move to customer private content)
If there are third-party AJAX requests that are triggered on each page, attempt to cache these requests or move them to customer private content. The merchant can do this by making sure that custom AJAX requests are called using the GET HTTP methods. It will make these requests cacheable by Fastly. If there are custom AJAX requests that should not be cached, they should be refactored according to private-content functionality. For steps, refer to DevDocs Private Content.
Reduce the number of requests
- Disable the persistent shopping cart, as it can increase the number of
customer/section/loadrequests. Follow the steps in Persistent shopping cart paths to see if persistent shopping cart is enabled.
- If you need to reload or invalidate content in
sections.xmlfollow the steps in DevDocs Private content: Invalidate private content. Please make sure that you are not using the
customerData.reload()method directly in your customizations.
- Check other POST AJAX requests on the same page. Open Google Chrome developer tool in Google Chrome browser. Click on the Network tab and then the XHR tab, and there will be the list of all AJAX requests from the particular page. Then click on each request and in the field Request Method should be the GET requests. Note: Google Chrome is used as an example and it is possible to do this in other browsers as well.
- Check Google Tag Manager (GTM) functionality which is a specific AJAX request. The user can remove this AJAX and refactor their customization with private functionality to reduce total number of requests to the server.
- Check if Magento Banner is enabled, but not used. You might need to Disable Magento Banner output to improve site performance.
For more information on private customer content review DevDocs Private content.