Successful Big Traffic Event with Magento on a Budget
We recently had one of our hosted Magento clients appear on The Today Show in the “Jill’s Steals and Deals” segment. This promotion results in thousands of orders in a short period of time, with tens of thousands of visitors. Needless to say, it’s a big deal for a small merchant.
Although there are Magento stores out there that can handle millions of visitors and many more orders, for a small merchant on a budget running Magento Community Edition, it takes some creative work and know-how to pull this off without breaking the bank.
Here’s how we handled the event for our client…
Preparation before the event
Planning is definitely needed to ensure success. With this event, The Today Show website links to a deals page. In order to handle the tens of thousands of visitors that hit the link right away, we went with a static web page on a Content Delivery Network (CDN), with all resources for that page also on the CDN. This way no hits occur to the main website initially.
A CDN is also a necessity for the main Magento site. Both non-secure and secure calls to images, css, and JavaScript files should all be on the CDN. SSL support is key so that the checkout portion of the site uses very little resources.
The client was already on a managed dedicated server, but we added a second server just for MySQL (connected over private Gigabit network). We’ve found that during high traffic events such as these, MySQL and PHP can often fight for CPU resources. Splitting up PHP and MySQL really helps with stabilizing CPU loading.
Caching plays a pivotal role in pulling this off without needing expensive load balanced scenarios. Caching includes:
- Built-in Magento caching properly set up
- PHP OpCode caching tuned for optimal speed and minimal memory consumption
- Full Page Cache extension so page loads are nearly static (both primary and secondary level)
- MySQL Query Caching tuned for the size of the database and type of queries
Having enough memory (RAM) on each server is required to keep things flowing smoothly. We’ve found that 32 GB on each server works well.
The day before the event
Leading up to the event, everything should be tested and in place. The static splash page, all blocks and code changes, graphics in place, etc… This allows time to fully test the site, making sure EVERY image, css, and JavaScript call is using the CDN, from catalog pages, to the shopping cart, through checkout. Using Firefox Developer Tools and sorting by domain on the “Network” tab is a simply way to show this is the case.
We also made sure that the site was fully cached, a technique known as “warming the cache”. A simple script that goes through all the pages (both without and with a product in the cart) to ensure that all primary and secondary caches are fully loaded, so the site is essentially a static site as much as possible.
Final adjustments are put in place for the web server (KeepAlive settings, minimum and maximum connections), MySQL (max connections, caching), and the operating system (max number of files, open connections, etc…)
Television segment airs
Within seconds of the client’s products being displayed on TV, traffic starts to spike to the CDN splash page, as shown below:
The CDN also sees tons of hits for all the accompanying web files:
Shortly after the CDN traffic, Magento itself starts to see lots of traffic to the cart and to the homepage as people start ordering the products and going to the website:
We saw increased load on the main PHP server, watching Apache peak at around 400 children. Real-time Google Analytics saw a peak of around 1,750 simultaneous visitors to the site itself, and we saw MySQL queries top out around 3,000 queries per second.
All through these first 10 minutes, the site was still snappy, while the cart and checkout process were still loading quickly. Here’s Google’s real-time data 8 minutes into the event:
At its peak, we saw a rate of Four Orders Per Second on the site. Over 1,000 orders were placed in the first 14 minutes of the event:
Almost 80,000 page views for the day:
The whole event was a success! No downtime, no lag or really slow pages, everything worked as planned. Thousands of orders were placed successfully, and we were able to leverage Magento without needing to resort to alternate order processes/software as other merchants often do for these events.
…
Summary
Magento 1 can easily handle a high traffic event like a TV appearance without costing a fortune. It takes proper planning and the right hosting environment, along with Magento know-how, to pull off a successful project such as we did for our client.
Hopefully the details in this post can be helpful to others for future events. If you’re looking for a web host that understands Magento, and can provide you with a personalized hands-on approach to hosting, drop us a line.
Looking for a web host that understands ecommerce and business hosting?
Check us out today!