In our previous post about helping the Delivergood Magento store by enabling a Cloudfront Content Delivery Network (CDN) distribution, we saw the benefits that a CDN could provide for their store’s scalability. Let’s go into detail about how you might shape your distribution by asking some questions.
Do you want the CDN distribution to take almost all the work off of your main server or only some of it? How busy do you want to keep the CDN distribution? All of these questions determine how much time you will put in obtaining the most out of your Cloudfront distribution. For example, the more work you want the CDN to do, the more work you will end up doing configuring both the host and the distribution properly.
In order to test scalability both with and without a distribution, we will do a series of load tests.
We’ll first start with our control, this is what we get without a CDN distribution:
Load Test of Magento store with no CDN
For a medium-sized server, this isn’t a whole lot of users. As a developer, you must take a deep look at your requirements. This might be enough for a few, but for performance sake there are greater heights. The next two tests involve a CDN distribution.
In the CDN-to-Magento linking process, the team discovered two central methods in how we want our distribution implemented. The first is static content delivery. With static delivery, your distribution is just responsible for serving images, layout, CSS and even JavaScript. All other elements though, are sent from your origin server. In this case you can think of your distribution as being more “laid back”. It’s only responsible for sending simple content. This method is easiest to implement, even in Magento. All you have to do is link your distribution in the Magento settings and you’re good to go. Keep in mind though, the scalability isn’t as great…
Load test of Magento store using static content delivery
You could get scalability between 130% and 300% from what we have seen. This might be good enough in your case for that extra handful of users. Static content delivery can almost be thought of as a “set it and forget it” method; not much manual maintenance is involved.
The second method is dynamic content delivery. Technically it should be thought of as static & dynamic content delivery, because with this method, static delivery is also occurring. Your distribution is responsible for static content (i.e. images, CSS, JS) and it is responsible for PHP and HTML pages. If your site requires users to login, you will need to set up cookie forwarding for Cloudfront. If users are submitting content to the server, you must remember to use PUT, POST, and PATCH protocols. Not to mention, you will likely want to do some domain changing so your website still has an acceptable URL. You can already tell that dynamic content delivery is much more challenging, but the rewards…
Load test of Magento store using dynamic content delivery
…might be more than worth it. By having your userbase hit the distribution for almost everything, you can see scalability reaching anywhere from 1000% – 1500%! This is where you can truly get your money’s worth from the distribution without even having to move your origin server to something larger.
The preceding load tests were performed with the LoadStorm Load Testing Tool on DeliverGood’s Magento store, where a CDN distribution was setup in each of the three statuses: none, static, and dynamic delivery. Implementing Cloudfront to work with Magento ultimately goes one of two ways.
Static content delivery can give you that extra boost of scalability without sinking in all the time and effort.
Dynamic content delivery will give you much greater scalability at the cost of more time and effort.
At this point it is up to the developer. Would it be worth it to invest the time and maintenance into making dynamic content delivery functional? Or does sticking with static provide enough scalability for your purposes? This is where web developer prowess come into play.