Architecting an ecommerce site – scalability & performance
Over RSAWEB’s years in web hosting we have helped everyone from small mom an pop shops using our shared web hosting platform to big multinationals with our Enterprise Cloud Servers. We’ve helped many customers grow and scale their infrastructure to meet various challenges. Ecommerce provides an excellent challenge where seasonal fluctuations, advertising campaigns, viral marketing, sometimes bad code, mobile apps, affiliate programs and various sources of traffic put varying amounts of strain on the underlying infrastructure.
The South African Ecommerce market is changing fast with more people getting online and moving past the critical ‘I’ve had 5 years of internet access’ where the internet (in whatever form) becomes part of their daily lives. At this tipping point people are far more likely to purchase online. In South Africa we have 11m+ users online now with 4.5m+ over the 5 years of use mark. The wave is here and more are coming.
The Database Bottleneck
Let’s deal with the database first, it is usually one of the biggest bottlenecks and we see customers ordering more servers instead of upgrading their disk. Most customers hit IOP (input/output operations per second) constraints on the hard disks with read & write intensive applications. This can be solved by adding Database servers or simply by deploying faster disk in the form of SSD’s giving ~40x more disk performance than spinning disk. Clever optimising of DB bottlenecks can speed up you application and save cost.
The Load Balancer
As your Ecommerce site gets busier you reach the limits of a single server and need to load balance between multiple web servers. A load balancer needs to be able to detect when a webserver fails and when a new server is added into the farm, with no manual configuration, in order to direct web users to a functioning server. Setting up your environment from the start with load balancing in mind saves pain later and enables you to add servers and resources on the fly with little downtime.
The Web Server Farm
Cloud Servers are ideal for web content processing and delivery. More can be cloned out or added with a few clicks of a button in our Cloud Control Panel. The configuration of these can be automated with a tool like Chef or Puppet as your site gets busier automating tasks will start to save time and money. An automation tool gives you a consistent mechanism to configure servers each and every time, the benefits of this are enormous. You can stand up a dev environment on our Cloud quickly, test your code changes and then destroy it when it is no longer needed. The key here is that on RSAWEB Cloud Servers you only pay for the hours your server is in use.
Caching, CDN & other performance gains
The importance of caching cannot be understated. Cache at each layer of your service but there is a fine balance between too much and too little. Too much means your customers start seeing out of date data and the wrong information in their shopping carts. Too little and your system will grind to a halt with all the background processing when you hit that seasonal spike or a product of yours gets tweeted by a celeb. We recommend tuning the various layers, tuning the MySQL cache’s, run code specific caching like APC if you run PHP, and split out your stats collection onto separate systems, maybe even running alternative Databases optimised by task like MongoDB or Cassandra rather than defaulting to MySQL or SQL.
Content Delivery Networks can offload a lot of the static content, away from your web servers.
So what next?
It is important to note that this can all be done quite easily but often fails when there is a migration to this way of thinking from a legacy way of building apps to the newer DevOps dynamic environment thinking. ‘Server hugger’ thinking will cause a project to fail if sysadmins don’t embrace DevOps in the Ecommerce space. DevOps solves many of the current management issues, its where automation prevails and nobody SSH’s into production servers anymore but thats for another post.
Ecommerce businesses typically experience rapid growth in South Africa due to the relatively uncontested landscape and the rapidly growing internet user base. We would love to show you how we were able to use our infrastructure building blocks like Cloud Servers, Content Delivery Network and RSAWEB’s CloudConnect to deliver a Hybrid Cloud service that scales and ensures 100% uptime.