magento / community-features

Magento Features Development is an Initiative to Allows Community Memebers Join to Development of Magento Features
46 stars 18 forks source link

Product save performance improvement #135

Open agata-maksymiuk opened 5 years ago

agata-maksymiuk commented 5 years ago

Summary (*)

Saving product has poor performance caused by product image cache generation on each save. It came in MAGETWO-32410: Grouped Product Integration API

It really kills every product import performance. In my opinion, it's not necessary since product image cache is generated on demand when cached image is requested.

We've imported 45,000 products with photos and it took 4 days. With these lines commented it took about 12 hours.

file vendor/magento/module-catalog/Model/Product.php

// Resize images for catalog product and save results to image cache /** @var Product\Image\Cache $imageCache */ if (!$this->_appState->isAreaCodeEmulated()) { $imageCache = $this->imageCacheFactory->create(); $imageCache->generate($this); }

Preconditions (*)

  1. Magento 2.2.5 EE (also happens on other Magento 2 versions)

Steps to reproduce (*)

  1. Create product with any 4-5 images via API

Expected result (*)

  1. Product is saved without generating image cache (as in Magento 1).

Actual result (*)

  1. Image cache for product is created and it makes every product import extremely slow.
kandy commented 5 years ago

Make sense to move image resize in queue, it resolves performance issues