Skip to content

Fix Performance Degradation in StockItem Indexation #91

@naydav

Description

@naydav

Several improvements need to be done for current indexation mechanism. As currently, we have a performance issue which leads to the whole re-indexation when any changes in SourceItem Qty happened (which is wrong).

1) Currently inventory_source_item table is used in mview configuration.
https://github.com/magento-engcom/magento2/blob/develop/app/code/Magento/Inventory/etc/mview.xml#L11
And system observes for source_id column.

But expected behavior should be an observation of source_item_id column. So our algorithm for \Magento\Inventory\Indexer\StockItem\StockItem::executeList should be like

  1. Obtain list of source_item_id
  2. Filter this list. We need to remove items which are related to disabled sources, and items with out_of_stock status
  3. Get index data only for these SKU that are related to source_item_id list after filtering
  4. Update index data via multiple insert on update
    Now our behavior (get stocks, after that get sources) looks is familiar to full reindex

2) Also we need to track changes in the inventory_source_stock_link table. In this case, we will work with source_id list. So maybe we need to create separate index processor which will be work with source_id.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions