Orders with many line items result in long frontend response times

j.sommer
j.sommer Spryker Solution Partner Posts: 2 🧑🏻‍🚀 - Cadet
edited December 2023 in Spryker Development

Hello everyone,

A problem we encountered during Black Friday was that customers who place large orders waited a long time for an order confirmation in the frontend.

To debug this issue I looked into the checkout process and measured the times of some methods. I discovered that the call of the runStateMachine method inside the CheckoutWorkflow class in the checkout module took by far the most time to process.

For an order with 260 line items that took 28 seconds to process, this method took roughly 25 seconds of that time. (Note: The most time gets used for database transactions that update the sales order items and insert the oms transition logs).

My solution was no to remove the runStateMachine method call from the placeOrder method and instead activate the initial StateMachine for new orders asynchronously via a Jenkins job.

Since the entire logic is inside the vendor code, my questions is if this problem is known or whether others have also encountered this issue?

Tagged:

Answers

  • domagoj.krizanec
    domagoj.krizanec Spryker Technology Partner Posts: 9 🧑🏻‍🚀 - Cadet

    We had the similar situation on one project. When you had at around 800 items in the cart, the customer would face 504 gateway timeout on the last checkout step because it would take too much time to process all this items in the place order action.

    An the solution that we came up to was the same one that you implemented. We checked the place order action and decided to keep the bare minimum that is necessary in there, and to re-delegate the rest of the necessary logic to some plugins that would be executed via Jenkins.