elgentos / largeconfigproducts
Installs: 3 282
Dependents: 0
Suggesters: 0
Security: 0
Stars: 91
Watchers: 16
Forks: 29
Open Issues: 6
Type:magento2-module
Requires
- php: ~5.5.0|~5.6.0|~7.0.0|~7.1.0|~7.2.0
- magento/module-configurable-product: ^100.2.8
- renatocason/magento2-module-mq: ^1.0
- renatocason/magento2-module-mq-mysql: ^1.1
- dev-master
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.17
- 0.2.16
- 0.2.15
- 0.2.14
- 0.2.13
- 0.2.12
- 0.2.11
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.0
- dev-replace-mcason-with-magento-mq
- dev-analysis-XaRjbx
- dev-eliminate-registry
- dev-eliminate-registry-1
- dev-add-config-options
- dev-peterjaap-patch-1
This package is auto-updated.
Last update: 2024-11-29 05:03:43 UTC
README
This extension is built to work around the problems Magento 2 is causing when using configurable products with extremely large amounts of simple products associated to it. Magento 2 can handle up to around 3000 associated simple products pretty well. Above that, it becomes extremely slow and sometimes unusable (such as webserver timeouts).
This version is only compatible with Magento 2.3.X
Example
Problems it tries to solve
The main problems are;
- In the frontend, Magento 2 loads all variations (associated simple products) in a giant JSON object and renders that into the DOM. This JSON object is 20 megabytes for 10k variations.
- In the backend, this JSON is also built and passed to a UI component wrapped in XML. PHP's xmllib is not able to append extremely large XML structures to an existing XML structure.
We have created workaround for both problems. In the frontend, we offload fetching the JSON blob through an AJAX request. The JSON itself can be pre-warmed using a console command and is stored in Redis. We chose Redis over the Magento cache system itself because Redis is not flushed when the entire Magento cache is flushed (for example, during deployment).
When the product page is loaded and there is no cache entry, it will create it then. This will of course take longer than pre-warming the cache entries.
In the backend we use DOMDocument's and the LIBXML_PARSEHUGE
constant to handle the extremely large XML structure.
This extension is free to use. If you find any bugs, please let us know. It has been tested on Magento 2.2.2 on PHP 7.0.
Console command
This extension comes with a console command, php bin/magento lcp:prewarm
. This console command pre-warms the JSON blobs so your customers don't have to wait for the cache to build up on the first hit on the product page.
The command has a few options;
--products 123,456,789
- define for which product ID(s) you want to run the prewarmer
--storecodes english,dutch,german
- define for which store code(s) you want to run the prewarmer
--force true
- force the prewarmer to overwrite existing entries. Otherwise the prewarmer will skip product/storecode combinations that already have an entry.
Magento 2.3.X
Magento 2.3.0 includes integrated message queue management using RabbitMQ, this has replaced the renatocason/magento2-module-mq module used for dynamic pre warming of configurable products after saving.
To use RabbitMQ messaging with this module you will require a RabbitMQ server accessible by Magento.
https://devdocs.magento.com/guides/v2.3/install-gde/prereq/install-rabbitmq.html
Configure the server in your env.php file
'queue' =>
array (
'amqp' =>
array (
'host' => 'magento2_rabbitmq_1',
'port' => 5672,
'user' => 'guest',
'password' => 'guest',
'virtualhost' => '/'
),
),
After installing the module run setup:upgrade to create the message queue. Confirm the message queue exists with
bin/magento queue:consumers:list
Start the message queue consumer with
bin/magento queue:consumers:start elgentos_magento_lcp_product_prewarm
To test dynamic updating of the cache edit and save a configurable product (parent or child)
You will see the prewarm process updating the cache
Processing 67..
Prewarming
Prewarming MH01 for store en (1/2)
Prewarming MH01 for store de (2/2)
Done prewarming
You can run the consumer as a background process. You may need to manage the consumer with a supervisor process to ensure it always runs. Alternatively if you are using Docker the consumer can run as a standalone container set to always restart.
Release Notes
0.4.0 - gaiterjones - 04.2020
Compatibility with Magento 2.3.x using built in AQMP/RabbitMQ integration
Removed requirement for renatocason/magento2-module-mq
Updated swatch-renderer-mixin updateBaseImage
Disabled configurable-customer-data from requirejs orginally used to auto select first option, not working in 2.3.x
Added option to disable cache per customer group so that group 0 is always used. Use this if you do not have customer group pricing