The fastest magento site ever!


Check out swann.com

I have overseen the build of 15+ magento websites and this one is the end result of all the learnings.

My client needed a rebuild of a website, they wanted a result that was clean, not-hacked-up, secure, fast and responsive. They also wanted a solution that was supportable and future proof and not tied to any one supplier ( including me! )

The build team was myself on architecture, magento config, devops, coordination of module suppliers and Dave ( from Swann ) on front-end design, Content management & testing.

Magento is a great and flexible ecommerce solution, however, it has a reputation for:
- Being slow due to its clever EAV database design
- Turning into a mess as developers take short cuts and modify the core files
- Becoming unstable and buggy as modules are added/removed from various suppliers
- Causing owners to be locked into one agency as they are the only ones who can change it.

Here is the approach I took to avoid the pitfalls in Magento builds and deliver the outcome that the customer wanted.

Rule 1.  No mods to the core files!
Rule 2.  Purchased third party modules are never loaded direct via their installers
Rule 3.  Everything under source control

All add-on modules ( about 10 ) were loaded to github. Modman/Composer wrappers were put in place. Composer was then used to build a "stage/test" version of our site. A single composer command brings down a fresh magento core and the latest versions of each of the modules from github. A single bash script then makes it ready to run.

Why? The beauty of composer is its ability to reverse out a module without leaving a mess. There is a black art to magento module selection. We ended up removing well known popular modules as they were not playing nice with other modules. Over the years I have built up a module supplier black/white list, there is a massive difference in the quality of magento modules/add-ons.

Rule 4.  Best practice Infrastructure.

Redis was used for sessions and cache. Mysql and Nginx were tuned for magento. If you are still using php5-fpm you are living in the past. HHVM from Facebook is well and truly production ready. Elasticsearch is a must. GTmetrix and Newrelic are great tools. We didn't even need to look at Varnish ( and its complexities ) to get the speed we wanted.

Rule 5. Bash scripts are your best friend

When ever we need to do dev-ops work we put it in a script. Index rebuild, Cache clear, Deploy stage-to-production. Go-live via webroot folder moves. There are simply too many config files and setups to try to remember. Scripts are easy to document, flexible, easy to read. Unless you are deploying multiple sites I would stay away from complex devops deployment tools

Rule 6. No crap modules. No second chances for modules if support isn't quick.

There are 1000's of modules for magento in the market. We ruthlessly discarded any that caused issue we also we only used module suppliers that provided warranty and good support. Composer allowed us to do this.  Buying $50 modules is false economy, buy the good one and pay for 60 days of support, it will still only cost a few hundred dollars.

Rule 7. Research what the experts are doing.

There are some super Magento techs on the net. Check github and the many forums. You will see the same names again and again. Follow their advice. It will lead to gems like n98-magerun and AOE-scheduler. From their generous open source contributions and articles I have built a best-practice knowledge base that never fails.

Conclusions

The outcome is a site that will pass an audit from tools like magento-mess-detector or by top end agencies that specialise in magento. The faceted search is so fast we were thinking of slowing it down so the user knows its working! The site is light and fast on mobile and the predictive search is very cool. Even the 5 store views for international did not slow it down.

The cost of the build was half that quoted by well know magento agencies. The age of Magento infrastructure as a service in cloud is here and with the right source control approach and module selection you can achieve complex sites without commissioning a single programmer.

Even if you are happy with your existing Magento site I believe by instigating a re-platform project like this you will save thousands per month on hosting and be able to deploy new features and changes at a fraction of the cost compared to the traditional agency approaches. Dave who started this project as a web-marketer with css/html skills now deploys new modules and features without calling in an agency or me. He has the confidence to do this as he knows we have built an environment where its is easy to roll-back changes.



No comments:

Post a Comment