A guest post by Ben Keeping, a freelance developer based in the UK, specializing in applications written in .NET and Ruby, using lean and agile techniques. He can be contacted @benkeeping.
Companies are moving to the cloud, but many are unwilling or unable to use the ‘public’ cloud and so ‘private’ cloud implementations are gaining traction. This post will look at some of the available options when moving your applications to a cloud provider.
Public Cloud – Platform as a Service
There are lots of ways to get up and running in the cloud. You can use Platform as a Service (PaaS) providers such as Heroku, AppHarbour, Engine Yard, Azure, AppFog, or Nodejitsu (to name a few), depending upon your preferences and language/runtime. Most of the popular languages and runtimes are supported: C#, Java, Ruby, Node.js and PHP.
These PaaS providers allow you to drop your application onto their servers, usually by hooking into a source control repository like BitBucket or GitHub. You push code to your source control repository, and a callback occurs, which gets your PaaS provider to pull the code and deploy it for you.
Public Cloud – Infrastructure as a Service
If you want more control over your deployment or a PaaS workflow that doesn’t fit, then Infrastructure as a Service (IaaS) could be a good fit for you. Amazon EC2 is one of the big players in the IaaS space, with many PaaS providers themselves such as Heroku and AppHarbor using EC2. Tier3, Rackspace and Azure are other providers to consider.
IaaS is a step closer to the metal in terms of running your application. While PaaS providers take care of deploying your code and getting your application up and running, IaaS providers take care of keeping your server up and running, but it’s up to you how you deploy and run your application.
PaaS or IaaS?
If you need to have complete control over the specification of your machine, which are almost always virtual, or you need to install very specific software, or have complex security requirements, then IaaS could be a better choice over PaaS.
If, however, you’re running a fairly stock application without any special requirements then PaaS could be the way to go.
The trade-off here is ease of deployment versus the ease of running a server. If you choose IaaS, then you’ll need to have server administration skills in your team. You’ll be responsible for keeping the operating system up to date, installing software patches, and making sure the firewall is configured. You’ll also need to work out how to deploy your application.
If you choose PaaS, the server administration is taken care of for you by the provider. You only have to worry about writing your application and getting the code to that provider.
Most IaaS cloud providers charge by the hour for a particular ‘size’ of an instance. How that is worked out depends upon how quick the machine is, how much disk you want, or how much bandwidth you require.
For example, you might choose a ‘small’ instance that has 2 virtual CPU’s, and 2 GBs of RAM, which may cost you say $0.02 an hour. Or you may choose a ‘large’ instance that has 8 virtual CPU’s, 16 GBs of RAM that may cost $0.10 an hour.
When working out the cost of using a cloud provider, you need to work out how much your current servers cost to maintain. Factors such as electricity, air conditioning, and licences may be obvious costs, but you need to consider other costs, such as how long does your infrastructure team spend patching, configuring and upgrading their servers?
With PaaS providers, cost is often calculated by the number of ‘workers.’ For example, Heroku uses the term ‘dyno,’ and AppHarbor uses the term ‘workers.’ The more workers you add, the more its going to cost. Most providers also adjust cost based upon whether or not you are on shared or dedicated infrastructure. So a website running on a virtual machine that has 100 websites will be far cheaper than a dedicated VM for your website. With regard to databases, cost also changes with the size and type of database. So a small MySQL database will cost less than a large SQL Server database.
Scale Up and Scale Out
Cloud providers allow you to scale up and out, normally using their own website, or through an API or provided command line tool.
With IaaS providers, scaling up means increasing the number of CPUs or RAM for a particular server. Scaling out means adding more servers and load balancing traffic between them. Providers such as EC2 allow you to save machine images to allow simple scaling out – you just ‘spin up’ another machine to add into your farm.
With PaaS providers, scaling up and out tends to be more simplified. Typically, scaling out means you increase the number of workers or processes that are serving your application. Scaling up means you choose a larger machine. Most can be done in a click of a button, and provisioning is often done (nearly) immediately.
The public cloud isn’t for everyone. Many companies want to run their own infrastructure for a variety of reasons.
Concern over intellectual property might mean you don’t want your codebase or your data leaving your company’s network. You may require every server to be non-virtualized, or have to comply with contracts or laws that prevent the use of farming out server administration to a 3rd party.
It’s possible to get the benefits of cloud infrastructure in terms of deployment, and some of the benefits of scaling out with a server farm running a private cloud. You can take advantage of auto deployment, application monitoring and load balancing, while keeping the physical infrastructure within your own data center.
Open source private cloud software such as OpenStack allows you to control networking, storage and launch server instances. So for example, you can provision a Linux server running Apache and MySql at the click of a button. You can control security groups, assign IP pools, etc. – all of the tasks you would expect to be fairly automated from a public IaaS provider, but within your corporate firewall. Scaling up would be done by upgrading physical machines, or more often by increasing the number of virtual CPUs if you’re running on a virtualized infrastructure. Scaling out means you’re adding more servers into your data center, or spinning up new instances in a virtualized environment.
Like public IaaS, you’re still going to have to be responsible for populating databases, building and deploying your applications.
One of the biggest private PaaS is Cloud Foundry, which was open sourced by VMWare. Cloud Foundry is software that allows you to spin up web apps through a command line tool. You build your application, package it, and in effect push the package to a master node, which then deploys your code to the slave nodes. The master node can be though of as a load balancer, which handles requests, and then passes that request onto a server.
It’s not quite as slick as a public PaaS such as Heroku, because it’s not monitoring your source control repository and deploying it automatically, but it’s certainly a step towards deployment automation.
Whether you choose public or private clouds, the choice is based upon many factors, but the benefits of cloud computing cannot be overemphasized. Repetitive tasks, such as building servers and code, running tests, monitoring and deploying applications, are ripe for automation. Release cycles that used to take hours can be reduced to seconds, allowing your team to focus on delivering business value, rather than repeating simple tasks. PaaS and IaaS providers, whether public or private mean that continuous delivery, or deployment on demand are within grasp of most companies.
For more details about public and private clouds, see the resources below from Safari Books Online.
Not a subscriber? Sign up for a free trial.
Safari Books Online has the content you need
|Cloud Computing begins with a discussion of parallel computing and architectures and distributed systems, then turns to contemporary cloud infrastructures, how they are being deployed at leading companies such as Amazon, Google and Apple, and how they can be applied in fields such as healthcare, banking and science. The book also examines how to successfully deploy a cloud application across the enterprise using virtualization, resource management and the right amount of networking support, including content delivery networks and storage area networks.|
|Cloud Computing Bible is just what you need if you’ll be using or implementing cloud computing. It helps define what cloud computing is and thoroughly explores the technologies, protocols, platforms and infrastructure that make it so desirable.|
About the author
|Ben Keeping is a freelance developer based in the UK. He currently specializes in applications written in .NET and Ruby, using lean and agile techniques. He can be contacted @benkeeping.|