Perils of Magento 2 Extensions

You know that crushing feeling when you are monitoring your architecture and you know you are about to lose the site and there is little you can do about it. So the site goes down, the business screams and you start the long process of identifying what exactly went wrong.

That analysis is where this post started. You can spend a long time digging through code and logs to get to the bottom of the problem and then find at the core of the matter some of the most ludicrous, thoughtless coding errors imaginable. More often than not this is caused by 3rd Party extensions that you installed in order to get some functionality out quickly.

I now realise that quick approach is really an anti-pattern throwing in an additional layer of complexity not of your own making. So not only are you going for speed over anything else you are also increasing your ignorance of the platform you are building. I don’t like complexity and I certainly do not like being ignorant of the platform that we are building.

Anyway back to the code problem. How about a module that every time you loaded a product page scanned through every record in the order_items table to count how many times that product had been ordered. Now on a test environment or a vanilla Magento install it will be fine. On a platform that has been running for years just watch the server grind slowly to its death. All because the developer thought it would be a good idea to show the user how many of a particular product had been sold. I like the idea and the functionality but surely someone would have suggested doing this on a cron or something and storing the results. Does it matter if it is a day out? This particular module was in the Magento marketplace as well.

And on to the second module, which decided to ignore the flat tables in the database and create a query against the EAV tables of such complexity that it toook us 3 days to decipher what the hell it was doing. Of course the problem was created because the developer just used the ORM to get all the data they thought they might need, which I will rant about in another post. The result was a query that at best took 4 seconds to run and at worst took 10 seconds. Again this was a module that was available in the Magento Marketplace.

In conclusion, do not go for speed of delivery, go for speed and stability of the site or you will be paying twice for that module.