When you think about the word elastic you tend to think about something that is stretchy, something that can expand and contract when it needs to, like an elastic waistband on a pair of pants or a rubber band.
Referring to the cloud as elastic has the same meaning. The elastic nature of the cloud refers to its ability to accommodate changes in load and demand of the system.
A traditional way
Let's use a graph to better illustrate the scaling concepts mentioned in the cloud scalable architectures section.
First, let's look at a more traditional, that is to say, non-elastic hosting environment, where we have a fairly fixed capacity and if changes in the capacity are needed, much planning, time and money are needed to make this change. So here, we have our capacity along the y-axis and let's just think of this as the number of web servers as an example.
Imagine you are on a team who is launching a new application soon and you are tasked with configuring the production environment to support this new application. Through much planning and estimation you have predicted you need to have five web servers. Now the team launches your cool new thing and you begin monitoring the usage of the capacity as customers start using it.
- Label 1: The first thing that we notice is that we have extra capacity at the beginning.
- Label 2: Now imagine the marketing team starts advertising and as this marketing team is really good we get an unexpected spike in traffic. This spike actually exceeds our allocated capacity and now customers trying to access the application are being denied. The application is down, everyone is complaining, this is not a happy place to be.
- Label 3: So you do some more planning, more predicting, make another large up-front investment and accommodate the marketing spikes but we also have dips in demand that cause considerable waste.
- Label 4: Demand fluctuates make this even worse than before. And of course this cycle keeps going as demand fluctuates.
In cloud computing
Enter the cloud, now let's take a look at the same scenario but this time you have deployed on cloud infrastructure and are able to take advantage of its elastic nature. Of course, we still have to do some planning and we have to decide to start with some capacity for launch. So your predictions are the same as before and you decide to again to start with five servers. Now as you watch your actual demand you may decide at the beginning that five servers is more than what was needed, no problem.
You can take advantage of the cloud's elasticity and quickly (by quickly means literally in a matter of minutes) scale in the web server tier from five servers to four servers thereby reducing the waste and saving money. So of course your monitoring continues and when the marketing team starts to have their success we notice that our four servers are now approaching full utilization. You can once again, very quickly scale things out to accommodate and can do so in a manner to always stay a step ahead and outpace the demand.
You can monitor server statistics such as CP utilization and when it rises above a certain threshold you add more servers or scale out and keep customers happy. And if levels again dip below certain thresholds you can remove servers and keep the accounting department happy.
Elasticity is one of the fundamental properties of the cloud. This power to scale computing resources up and down easily, will ultimately drive most of the benefits of the cloud. So you really should work to internalize this concept and always be thinking of ways to work it in to your application architecture in order to maximize the benefits of the cloud.
This elastic nature of the cloud really changes the way you think about your architectures and designs and as such, you will need to let go of some of your old habits and old ways of thinking.
- Dependency injection
- Directives and Pipes
- Data binding
- HTTP Get vs. Post
- Node.js is everywhere
- MongoDB root user
- Prefer Async Script Loading
- Components, Bootstrap and DOM
- What is HEAD in git?
- Show the changes in Git.
- What is AngularJS 2?
- Confidence Interval for a Population Mean
- Accuracy vs. Precision
- Sampling Distribution
- Working with the Normal Distribution
- Standardized score - Z score
- Evaluating the Normal Distribution
- What is Nodejs? Advantages and disadvantage?
- How do I debug Nodejs applications?
- Sync directory search using fs.readdirSync