Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Magento so slow? [closed]

People also ask

Why is Magento so slow?

Magento is so slow because you may be using unnecessary themes, extensions, and customizations. Also, Slow hardware, far hosting server, not caching data, not enabling flat catalog, not minifying CSS and JS, and not updating your store lead to Magento's slow performance.

Why is Magento so difficult?

Magento is complicated because of its design. Main aim of magento is eleminate programmer in ecommerce projects much as possible. To archieve this magento uses Entity–attribute–value (eav) model.

Why Magento 2 is so slow on localhost?

One poorly written extension can significantly slow down overall Magento performance. Make a list of all the installed extensions, turn them off one by one and see if it affects the loading speed in any way. Or try to install a default Magento 2 and see if it runs any faster then the customized version.


I've only been tangentially involved in optimizing Magento for performance, but here's a few reasons why the system is so slow

  1. Parts of Magento use an EAV database system implemented on top of MySQL. This means querying for a single "thing" often means querying multiple rows

  2. There's a lot of things behind the scenes (application configuration, system config, layout config, etc.) that involve building up giant XML trees in memory and then "querying" those same trees for information. This takes both memory (storing the trees) and CPU (parsing the trees). Some of these (especially the layout tree) are huge. Also, unless caching is on, these tree are built up from files on disk and on each request.

  3. Magento uses its configuration system to allow you to override classes. This is a powerful feature, but it means anytime a model, helper, or controller is instantiated, extra PHP instructions need to run to determine if an original class file or an override class files is needed. This adds up.

  4. Besides the layout system, Magento's template system involves a lot of recursive rendering. This adds up.

In general, the Magento Engineers were tasked, first and foremost, with building the most flexible, customizable system possible, and worry about performance later.

The first thing you can do to ensure better performance is turn caching on (System -> Cache Management). This will relieve some of the CPU/disk blocking that goes on while Magento is building up its various XML trees.

The second thing you'll want to do is ensure your host and operations team has experience performance tuning Magento. If you're relying on the $7/month plan to see you through, well, good luck with that.


Further to Alan Storm's recommendations on caching, there's two things I'd specifically recommend you look into related to caching:

- Make sure caching is in memcached, rather than on disk.

I look after a couple of magento installs, and once you get any sort of load on the system, memcached starts to perform much faster. And its dead easy to change it over (relative to doing other magento stuff at least!)

Good starting point is here: http://www.magentocommerce.com/boards/viewthread/12998/P30/ - but if you've not used memcached at all before, its worth looking at some general info about it as well.

- Enable template/view caching.

This is a good article: http://inchoo.net/ecommerce/magento/magento-block-caching/

There are good ones on the magento site too (google magento block caching), but its down at the moment.

To add my two cents to the block caching, I'd advise you create your own blocks in /app/code/local, extending the core ones and defining the cache parameters, name them xxx_Cache and then update your layout to use these blocks instead of the core ones. This way, you avoid losing your changes or breaking the system when you upgrade magento.


If you haven't seen it yet, Magento and Rackspace teamed up to create a white paper on performance tuning Magento. It's excellent. https://support.rackspace.com/whitepapers/building-secure-scalable-and-highly-available-magento-stores-powered-by-rackspace-solutions/

--- edit ---

Another great resource, newly available (Oct 2011) is: http://www.sessiondigital.com/assets/Uploads/Mag-Perf-WP-final.pdf

(Thanks due to Alan Storm on this one.)


There is possibly also a very non-obvious reason why your admin interface is very slow. Magento has a module named Mage_AdminNotification. Try to disable that ext. Because what it does is query magentocommerce.com for new update messages. If their servers are slow your admin page waits and is in effect slow because of the network lag and loading of the external news. If you have secured your outgoing server connection through a firewall this can be even more frustrating, since the admin interface will wait for the timeout when it cannot reach magentocommerce.com

To disable it: go to System -> Configuration, scroll to the bottom and hit Advanced(in the Advanced section). Now disable Mage_AdminNotification and save!