Cloud auto scaling and budgeting your IT
Anyone venturing into a tech business or a tech enabled business knows how difficult and crucial it is to choose the right IT platform and software stack for the venture. In today's world IT planning can make or break your business. So a sound plan for your IT will ensure that your IT investment goes a long way in sustaining your future business needs.
With most mature open source software coming at zero upfront cost and covering whole of the application stack, it boils down to which IT infrastructure provider you want to go with so that your costs remain within budget. Right now most of us have these options when it comes to hosting our IT infrastructure - Shared hosting, VPS (virtual private server), Dedicated servers, Cloud IaaS (infrastructure as a service), Private data center.
Now let us see how each of the above can have an impact on our costs and sustainability of our business.
Shared hosting is the cheapest option available in the market, cost is predictable and is an option many go with when they begin. But soon you will realize that it just doesn't scale! Your options of tweaking the server or the software are limited and the computing power available to you is insufficient and shared with a lot of users. Shared hosting at best is useful for hosting static websites with a contact us form.
VPS and Dedicated servers are a good option if you want to have a well performing website or application for your business. This setup also has a predictable cost though quite a bit more than shared hosting, but has sufficient computing power depending upon your VPS / Dedicated server configuration. It can easily deal with a lot of users and can handle complex applications. With you having complete control over the software, VPS / Dedicated server allows you to tweak your software in all possible ways to extract maximum performance. In the short term VPS and Dedicated servers can serve you and your customers well. It's limitation start to show when your business grows beyond what you had planned for in a short while. Adding additional hardware or horizontal scaling can bail you out in that situation but it is an arduous task. With horizontal scaling will come added cost of extra hardware and people to manage the same. Though adding and managing extra servers may not be a great deal when business is great but what if you need to cut down when business is not doing great. Your long term contracts with the hosting provider may come into your way when you want to scale down a VPS / Dedicated IT hosting plan.
Before going into discussing Cloud IaaS lets see what a private data center has to offer in terms of cost. Private data centers can make sense when you have a fair bit of idea that the computing power and data you need to manage for your business will surpass a dozen high capacity dedicated servers and you need additional servers for your development team, testing and third party integration. Private data centers are also a must when your data and business strategy must be safe guarded from any external access or control. Private data centers are most expensive to host your IT infrastructure as it involves cost for real estate, servers, power, cooling, security, government regulations and server administration and is not recommended if you are not the next Google or Amazon.
Now let us come to Cloud IaaS and auto scaling to save the day for us. Well a cloud VPS is no different than regular VPS other than data redundancy where cloud offers a more fault tolerant infrastructure which can keep your data safe without much effort on your part. But we are not interested in data redundancy feature alone. What we want is a truly flexible hosting solution which can grow and shrink as per our needs so that we spend only on what we are using and not on idle hardware sitting around just because it came as part of the hosting plan. Cloud IaaS auto scaling can be our best bet in this scenario. Auto scaling is a feature provided by most big cloud vendors like AWS, Azure and Google to name a few. Now what is auto scaling? Auto scaling is basically creating copies of your cloud VM (virtual machine) as per your usage policy of the VM so that you have your computing load distributed over these VMs when there is a spike in load. It works also in the reverse, that is when load falls below a certain threshold, copies of VM can be deleted so that you are not paying for any idle VMs. Auto scaling needs something called load balancing to distribute the load to the auto scaled VMs.
I will give you simple example below of a website setup on cloud which can be auto scaled easily.
Say to begin with you have a VM running the web server and to run the website code in PHP. We will call this VM-PHP. You have a separate VM as your database server. We will call this VM-DB. You have another VM as a file server to keep user generated files. We will call this VM-FS. VM-FS can be optional if users do not upload files to your server. Finally you have another VM to store user sessions. We will call this VM-SESS.
VM-PHP will be running your website application code and will heavily interact with the VM-DB. It will save user uploaded files in VM-FS as and when required. VM-PHP will also store logged in user information in the VM-SESS and will resume user sessions by fetching data from VM-SESS. So what we will find is VM-PHP will be driving the whole setup and will be mostly running near it's full computing capacity. We will setup auto scaling for VM-PHP with a policy that when the CPU usage is above 60% for more than 1 hour, spin a new VM-PHP. Auto scaling will create an exact replica of our VM-PHP, lets call it VM-PHP-2 and start routing new requests to the VM-PHP-2 whenever auto scaling policy parameters are met. This way auto scaling can handle as many users as you want transparently without any manual intervention. Similarly we can have a policy for scaling down when a VM-PHP-# has CPU usage of less than 10% for more than 1 hour then delete that VM-PHP-#.
As you can see with just an intelligent setup and auto scaling enabled you can be sure that your customers are not struggling to consume your cloud hosted IT services. You also pay only for cloud VMs you use and your cost is proportional to consumption of your IT services. Auto scaling takes away the pain of capacity planning for your IT infrastructure. Let me know if auto scaling is something you would like to consider for your IT setup looking at the advantages it offers or if you have better things in mind.