Like most e-commerce sites, this one has a shopping basket summary on every page to show the user how many items they have in their basket, and the basket's subtotal. We were running the basket pipeline before rendering this summary to make sure that the total was up to date, which means that the pipeline was running at least once per page. It also ran additional times if any items were added to the cart during that request. As it turned out, even running it once was our bottleneck by a long shot.
This information led us to a new approach:
- Whenever the basket is modified (e.g., when an item is added), the basket pipeline will be run and the basket saved.
- The basket summary will use the totals saved from the last time the pipeline was run. These totals may be stale if any item's price has changed since it was added to the cart.
- The user will be required to review their cart before checking out. This page will run the basket pipeline again to make sure that the user is being given the most up-to-date prices.
No comments:
Post a Comment