Magento 2 module which showcases how to run resource-heavy processes asynchronously using multiple threads with ReactPHP ChildProcess and HttpClient libraries.
- Magento 2.2 or higher
- PHP 7.1
You can install the module by downloading a .zip file and unpacking it inside
app/code/MSlwk/ReactPhpPlayground
directory inside your Magento
or via Composer (recommended).
To install the module via Composer simply run
composer require mslwk/module-reactphp-playground
Than enable the module by running these command in the root of your Magento installation
bin/magento module:enable MSlwk_ReactPhpPlayground
bin/magento setup:upgrade
The module contains PHP CLI scripts which don't require Magento. They present the potential differences between the same calculations run on 1, 2 and 4 threads.
- To run HttpClient example start the
Standalone/bin/http
script - To run ChildProcess example start the
Standalone/bin/childprocess
script
The module contains 2 commands available via bin/magento
. You can choose the number of threads to use.
- To run HttpClient example use
bin/magento mslwk:webapi-reporting-start <<number_of_threads>>
- To run ChildProcess example use
bin/magento mslwk:cli-reporting-start <<number_of_threads>>
- Maciej Sławik - https://github.com/maciejslawik
This project is licensed under the MIT License - see the LICENSE file for details