When scaling to large ecommerce implementations, you have to get good at multiplication. Multiplied over millions of transactions, the difference between 4 nines and 6 nines of reliability can be a billion dollars.

In this three-post series, We will go over three important areas of scaling Magento. This post is about the coding of Magento Enterprise. The next post is about building out large-scale enterprise infrastructure. Finally, the surprise section: working in the teams needed to accomplish these tasks.

The first two may seem more substantial at first, but we strongly feel that the human element of these projects is absolutely crucial to the success of these sorts of projects. When the difference between .0001 and .00001 is measured in the millions of dollars and the code base is over 820,000 lines of PHP, you need the team that is working at their best.

We are basing these best practices on a project we recently completed. A retail client brought us in to implement a Magento Enterprise upgrade that required some extensive design and engineering by a large team in a short timeline.

CODE FOR SCALING

Magento Enterprise can be made to work without best practices, but organizations inevitably suffer from the long term results. When supporting the massive transactions of a large ecommerce site, a code base needs to be built with two directives:

  • Find every efficiency
  • Think about the lifecycle

These principles need to be applied from the ground up. We have been called in more than once to re-engineer sites that technically were functional but hamstrung the company with poor performance and a fragile codebase.

EFFICIENT PHP

Making the code work in a functional test is just not enough. With the available complexities of Magento, there are a thousand ways to accomplish any task. When every wasted clock cycle or round trip to the database is going to be multiplied by millions or billions, you have to take the time to identify the most efficient way to accomplish every task.

As an example, question Magento defaults. Copious Senior Software Developer Aaron Edmonds notes that the default indexing routine for catalog items will create SEO friendly URLs for every item in the catalog — even items that are flagged “not visible.” For a recent project, he altered the indexing process to only create URLs for visible items. The index was reduced by 95%. The indexing process went from taking 12 hours to 30 minutes.

BUILD A FOUNDATION FOR THE FUTURE

Best practices for Magento are well known but easily defied. Seasoned Magento developers have all run into trouble trying to expand an existing implementation in which core files have been modified. Very often, even in the Magento forums, you will find recommendations to solve a problem by changing the core application code.

Magento installations of any significant age and size will likely contain a fair amount of poorly architected functionality like this. It makes upgrading or additional modifications far more complex, requiring deep investigation and meticulous testing, with very few exceptions. The long-term cost is simply not worth the short term solution.

The code needs a home, and that home is a sturdy server infrastructure. The next post in this series, Scaling Magento Best Practices: Infrastructure, will focus primarily on load balancing, hardware profiles and mission critical requirements such as redundancy and failover.