Skip to content
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

Added Decoupling of Checkout endpoint and OMS commands to architectur… #2982

Merged
merged 11 commits into from
Jan 17, 2025
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ commonOptions = {
/redisdesktop.com\/[\.\w\-\/\?]+/,
/developer.computop.com\/[\.\w\-\/\?]+/,
/www.centralbank.cy\/[\.\w\-\/\?]+/,
/www.gnu.org\/[\.\w\-\/\?]+/,
/algolia.com\/[\.\w\-\/\?]+/,
/www.facebook.com\/[\.\w\-\/\?]+/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,20 +220,24 @@ Zed calls are necessary when it comes to executing a database-related operation
- Exporting necessary data, only product-related ones, from Zed to Redis at the pre-calculation phase with the help of Publish and Synchronization.
- Merging duplicate Zed requests to only one customer request (AddToCart + Validations + …).

{% info_block infoBox "Info" %}
{% info_block infoBox "" %}

Avoid making ZED calls within QueryExpanderPlugin (from Storage or Search).

{% endinfo_block %}

### OMS optimization

OMS processes are the template of the order fulfillment in Spryker. The first state of OMS processes, called the NEW state, plays an important role in the checkout process. Therefore, it's necessary to make sure you don't use unnecessary features when you don't need them, for example, Reservation or Timeout transitions.
OMS processes are the template of the order fulfillment in Spryker. The first state of OMS processes, called the NEW state, plays an important role in the checkout process. So, make sure transitions related to unsused features are disabled, for exampleReservation or Timeout transitions.

One can avoid using the unnecessary transitions by:
You can avoid using the unnecessary transitions as follows:

- Removing the *Reservation* flag from the NEW and other steps in the OMS.
- Removing the *Timeout* transition from the NEW step in the OMS.
- Remove the `Reservation` flag from the `NEW` and other steps in the OMS.
- Remove the `Timeout` transition from the `NEW` step in the OMS.

For more ways to optimize OMS, see the following docs:
* [Slow checkout endpoint](/docs/pbc/all/order-management-system/{{site.version}}/base-shop/datapayload-conversion/state-machine/common-pitfalls-in-oms-design.html#slow-checkout-endpoint)
* [Optimize order placement performance](/docs/pbc/all/order-management-system/{{site.version}}/base-shop/datapayload-conversion/state-machine/common-pitfalls-in-oms-design.html#optimize-order-placement-performance)

### Performance checklist

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,35 @@ To regenerate the cache, run the following command:
vendor/bin/console oms:process-cache:warm-up
```

## Slow checkout endpoint

**Issue:** During the checkout process, order items are created in the `new` status by default and immediately become part of the OMS workflow. Any `onEnter` event with command from the state `new` is executed within the same PHP process as the checkout. This can significantly increase processing time of checkout requests.

![coupled_new_state_to_command](https://spryker.s3.eu-central-1.amazonaws.com/docs/pbc/all/order-management-system/base-shop/datapayload-conversion/state-machine/common-pitfalls-in-oms-design.md/coupled_new_state_to_command.png)

**Solution:** Postpone all subsequent transitions from the `new` state. Configure transitions to be executed in the background by Jenkins triggering `console oms:check-condition`.

![decoupled_new_state_from_command](https://spryker.s3.eu-central-1.amazonaws.com/docs/pbc/all/order-management-system/base-shop/datapayload-conversion/state-machine/common-pitfalls-in-oms-design.md/decoupled_new_state_from_command.png)

```xml
<transitions>
<transition happy="true">
<source>new</source>
<target>ready for confirmation</target>
</transition>
<transition happy="true">
<source>ready for confirmation</source>
<target>confirmation sent</target>
<event>confirmation</event>
</transition>
</transitions>
<events>
<event name="confirmation" onEnter="true" command="Oms/SendOrderConfirmation"/>
</events>
```



## Optimize order placement performance

To speed up order placement, you can configure OMS to be executed asynchronously with order placement. After an order is created, OMS processing stops, enabling the order to be created quicker. The OMS processing of the order happens after the `oms:check-condition` command is executed.
Expand Down
Loading