I get requests for help with scaling issues so often that I thought I'd take some time to create a series of articles about the topic. Today I'm going to talk about architecting your server stack for better efficiency.
If you are like most people I talk to, you have one multiple purpose web server. It runs your Prosper202 ClickServer, databases, and hosts your landing pages. You may even be using it to host your Wordpress blogs as well. When things start to slow down you contact your friendly hosting partner and request a bigger faster server, everything still runs on the same server, but it's more powerful. You may not realize this, but you are wasting resources and not getting the best out of your technology budget
I'd like to propose a a better wayInstead of lumping everything up together into one server, break things up into multiple specialized servers. The simplest upgrade to what you are probably doing right now is to have a dedicated app server and a database server.
The App ServerAs the name implies, the App server is where all your applications reside. This includes your Prosper202 ClickServer software, Wordpress, and any other scripts that you may have for your marketing and business needs. You are now free to optimize your configurations to enable that server to run scripts and applications efficiently.
The Database serverYou will now have a dedicated machine just for your databases. On this machine you can eliminate all the server process and applications that have nothing to do with running a database. For example, you don't really need php on the server that runs your database. So this frees up more memory and cpu for your database to do what it does best. You can also spend more on components that really matter to your database such as the best and fastest SSD hard drives, and memory upgrades.
By employing the concept of specialization, you are able to get the most of out your hardware. But most importantly, your entire technology stack runs more smoothly. Later on, when you are ready to scale up to an even more efficient and high availability setup, you will have the building blocks needed to start off on the right track.
Taking things to the next level of geekness
Here's an example of a setup that you could have your tech team build out for you.
All traffic is sent first to a load balancer. Think of a load balancer as a traffic director. The load balancer will then forward the traffic on to one of your multiple app servers. This means that you will have more than one server handling your traffic. At the minimum you can have 2 app servers, but 3 is even better. With 3 app servers, each one can handle 33% of your server load and if something goes wrong with one server, the load balancer will automatically stop sending traffic to that machine, and redirect everything to the remaining two servers. This also allows you to do maintenance or swap in a new server with zero downtime.
Next, you have your caching layer. Usually this is something like Memcached. You can run this as a standalone server or if you have extra ram available, you could run it on each of your app servers. The cache layer speeds up database read operations by allowing you to not to use the database constantly for reading data. Instead of doing a database query, it can pull that data directly from RAM. This alone can speed things up by 10x or more, because RAM is so much faster than even the fasted SSD hard drives. We built our BlazerCache Technology on top of Memcached, so to activate it, just install a Memcached server and tell Prosper202 where to find it. BlazerCache will be activated automatically.
Finally, you have your database servers. You will have the main database, and a replica or replication database. The replica is kept in sync with the main database and is ready to take over in the event of any down time on your main database server. You can also use the replica for read only operations. When you are running reports, since you are not actually changing any of the data already saved in your Proper202 ClickServer, the replica database is perfect for this. So you offload all the reporting work to that replica, leaving the main database with more resource to focus on writing new data as quickly as possible.
Now you know that having your servers perform specialized tasks can help you achieve better performance, scalability and availability from your server. For anyone doing serious volume, the bottle neck created by an inefficient server setup costs thousands in lost revenue, sometimes on a daily basis. I hope this quick guide puts you on the right path to solving your growing pains.
Your Homework For TodayTalk to your hosting provider about splitting things up onto a minimum of two servers. I've made the architecture diagram available in PDF format to share with your tech team when you are ready to upgrade your server setup.
Alternatively, you may also want to signup for a hosted Tracking202 ClickServer account. We take care of all of this for you and more. Download Optimized Tracking Server Architecture Diagram (PDF: 143kb)
My team and I are also available to consult and build out complex system architectures like this and better with a limited number of clients every month.