Magento Site Performance Optimization by Mathieu Nayrolles is a handy little primer on the basics of optimizing a server for magento. This little gem covers the basics, doesn’t spend a lot of time on fluff, and moves quickly into optimizing MySQL and covers the basics of using two mysql instances (through replication) one for writing and another for reading.
Chapter 1: Starting with the Right Hardware covers the basics of choosing what hardware is necessary, and how to decide who is a good host. I found the section of choosing a host to be very light because it basically suggests finding a magento recommended host and finding somebody located in the same country. It didn’t really cover much in the way of latency, dns, etc. The section on Content Delivery Networks left a lot to be desired, and really should have looked at some of the avaialble plugins.
Chapter 2: ￼Choosing the Best Web Server is about some of the different options available out there for serving websites on linux. Makes perfect sense to cover the normal Apache and lighttpd. The Apache section discusses the standard .htaccess modifications, compiling Apache with some of the modules, and disabling what you aren’t using. Overall, the Apache section was good for a basic primer. I’m interested in using lightttpd more after reading a bit about it.
Surprisingly, Mathieu also covers Nginx which turns out to be much better for hosting magento once it’s properly tuned. This chapter was one of the most interesting and useful to me. I haven’t ever really looked at the numbers in the way he presented them or decided to try and load test configuration settings as I made each one.
Chapter 3: Tuning, Scaling, and Replicating MySQL covered exactly like the title says. This chapter discussed a bit about some of the different scripts available, but the real gem was the discussion about replication and how to configure it in magento. I didn’t realize I could setup two mysql instances and have magento read and write to different ones.
￼Chapter 4: Caching Them All starts off with one of the first things I try to do with caching. Turn off most of it, and see how much it changes performance. On nearly every system, I’ve worked on the performance has actually improved because writing to files and reading the files for differences is usually more expensive than just pulling the data again from the database.
Mathieu presents a reall interesting approach, that again I hadn’t really thought of which is using the RAM hold /var/cache which seems like it could be a significant improvement for the caching since most sites are using SCSI drives and not SSD like his examples.
The different caching technologies covered aren’t covered in great detail, and don’t really have that same level of details as Chapter 2 which was pretty disappointing. I had hoped we would spend some more time and energy discussing full page caching, which I find to one of the greatest optimizations to be using full page caching.
The real beauty of Chapter 4 is the section on HipHop Virtual Machine (HHVM) which is something I’ve actually never heard of before. I can’t wait to try it in the next few months and test it on on my site. HHVM is open source and produced by Facebook.
Overall, I found the book to be detailed, easy to follow and full of useful information. Also fantastic is the fact there aren’t twenty pages devoted to installing magento; the book is free of fluff and really introductory details. I also felt that it really left a lot to be desired too. Hopefully, in the next version they can spend a bit more time discussing hosts,content delivery networks and some of the code enhancements that can be done to improve speed.
Author: Brian Cline