Lately i had some troubles with my Magento 2 (running 2.2.1) server, it was using way to much resources for 1 lightly used webshop.
This server had 1 shop live, and 4 others nearing completion… having 5 shops from 1 single magento 2 installation with 8K products was a bit too much for the small hosting/server.
(most shops use many of the same products, so 1 product is available in 3 different shops)
So i removed 2 shops which used about 4000 products, multiply that with 2x times the URL keys, meta tags etc… so the database got big fast.
Removal helped on that front… but it had still the theme’s and extra modules installed.
Since the 2 above mentioned shops where deleted i had no use for 3 modules anymore.
At the same time (and also before) i had problems with running out of ram memory.
Appearantly there are 2 ways to remove modules in Magento 2.
1: via Composer (if installed with composer)
2: via bin/magento module:uninstall <module name>
Since i first installed the modules trough Composer, i removed them with the “composer remove” command.
Apparently, that is not the perfect way.
On tuesday evening i removed 2 modules with the composer remove command, and after that my RAM use and CPU use shot up!
whuh? i’d expected them to be lower.
i’m not technical enough to give a proper explaination, but it looks like magento 2 keeps looking for those 2 removed modules in her own registery.
After some struggles i’ve managed to re-install the modules with composer (required to upgrade the server with more RAM) and then remove them with “bin/magento module:uninstall”
That made some effects to the CPU & RAM! (done that on Thursday afternoon, see graphic above)
As a side effect, my harddisk activity is also reduced to almost zero, well not visible on this scale at least.
And this, i cannot explain..but it is good none the less 🙂