sdinteractive / SomethingDigital_EnterpriseIndexPerf

Magento EE index performance optimization
MIT License
8 stars 3 forks source link

Utilize the enterprise indexes for smart categories #13

Closed toddbc closed 8 years ago

toddbc commented 8 years ago

This does a few important things:

  1. If product flat is enabled, use its events to reindex smart categories. This means it's cheaper when products aren't changing, but much more immediate when they do change.
  2. Use a delta approach when updating smart category contents: only touch products that actually change (either in position, or membership in the category.) This is a critical change, read below.
  3. If a smart category is only smart to enable sorting, but does not apply any attribute logic, skip running membership updates entirely. With delta updates, this is just an optimization to reduce runtime.

Note that when product category membership is changed:

All of these would happen for every product in a smart category, every time the smart category was reevaluated. These changes, along with #10, prevent that so FPC and indexes are only touched for products that actually change.

This however does mean potentially more full smart category reindexes (e.g. when product data changes frequently.) Based on testing, when the membership doesn't change or changes very little, this is fairly inexpensive even on a large catalog.

philwinkle commented 8 years ago

Incredible work here. Very concise and easy to follow. I can't find anything wrong with it to be honest. I'm pulling it down to test on a vanilla 1.14 and will report back with findings.

philwinkle commented 8 years ago

@toddbc could you add the Ticket # you're billing to please?

toddbc commented 8 years ago

Ticket #331346.

philwinkle commented 8 years ago

This looks good. It works seamlessly for me on local Mage 1.14. Great work.