In Magento 2, there are roughly 115,000 products in the store. There are 7 customer groups. When importing prices via csv, the batch upload slowly imports the price but eventually crawls to a stop. I've checked all error logs in my server, can't find any failure notices in magento logs, or any other server logs. No email is sent.
More details on the setup:
- RHEL 7
- PHP 7
- Apache
- MySQL
- Magento 2.1 EE
How I setup up the import is through a scheduled task, and hitting 'run'. I've tried batches of 50000, 10000, 5000, 1000. All have the same effect. When uploading products, customers, and availability – Magento had no issue with big bulk uploading.
Another symptom I may be seeing is bin/magento indexer:reindex takes no more than :30 seconds for each category, except for Prices and EAV. It takes over 3 minutes each. Currently there only 3000 prices in the database, so 3 minutes to reindex seems like a lot.
Has anyone come across this? Any suggested fixes?
Best Answer
Magento 2.x even though it's "supposed to be faster than Magento 1.x", the stack has doubled in size going from ~40 PHP files per request to ~80 PHP files to fulfill a single request, with the inclusion of vendors/composer. Keep this in mind if you are seeing a lot of disk I/O when locating bottlenecks.
However most of the bottleneck will likely be at the MySQL level:
indexing
&cron
jobs or shut down all other services that are not needed during the import processes.max_allowed_packet
that is larger than the default, 16MBinnodb_flush_log_at_trx_commit
to the value2
in yourmy.cnf
config file to avoid over cautious writings while in a non production time frame.htop
,mytop
,iotop
,sysdig
and the best weapon of choice is:strace
, and while in htop "s" keyboard shortcut on the highlighted process will basically runstrace
with the parameter of the processes ID highlighted. Or justps waux | grep mysql
and locate the id of the process andstrace <PID>
.For the slow indexing process: Recreate the MySQL triggers for the indexer, and enable the Scheduled indexing process (make sure cron is setup/enabled)
php bin/magento index:trigger:recreate -vvv
The indexer in Magento 2 relies heavily on the MySQL trigger feature to speed up indexing, along with changelogs & the cron jobs keeping the indexer updated with deltas, instead of ignoring whats changed when doing a full reindex.
Details: Magento 2.1 on MySQL.
EDIT
Additional MySQL Settings regarding large import of data: