We applications and websites get measurable traffic, recorded in metrics such as pageviews, unique visitors, and visits. All of this activity translates to hits to a webserver, and work for a database to retrieve information for those pages.
During one month your application might get 150,000 visits, then during one week where a large ad campaign hits, or some marketing feature goes viral, you suddenly get 500,000 visits in one week! This is a “good problem to have” on the business side, but poses great challenges to an infrastructure as it represents a 7x increase. What’s more if you do your capacity planning around that peak, you’ll have in 600% of your computing power and servers sitting around idle most of the year (assuming that’s just a blip).
Therein lies the challenge of seasonal traffic variations. Capacity planning attempts to watch for trends in traffic, and growth over time of your user base. But large spikes like the one described above can often be difficult to predict. The whim of the masses.
Sean Hull asks on Quora – What are seasonal traffic variations and why are they important?
Scalability in the cloud depends a lot on application design. Keep these important points in mind when you are designing your web application and you will scale much more naturally and easily in the cloud.
** Original article — Intro to EC2 Cloud Deployments **
1. Think twice before sharding
- It increases your infrastructure and application complexity
- it reduces availability – more servers mean more outages
- have to worry about globally unique primary keys
2. Bake read/write database access into the application
- allows you to check for stale data, fallback to write master
- creates higher availability for read-only data
- gracefully degrade to read-only website functionality if master goes down
- horizontal scalability melds nicely with cloud infrastructure and IAAS
3. Save application state in the database
- avoid in-memory locking structures that won’t scale with multiple web application servers
- consider a database field for managing application locks
- consider stored procedures for isolating and insulating developers from db particulars
- a last updated timestamp field can be your friend
4. Consider Dynamic or Auto-scaling
- great feature of cloud, spinup new servers to handle load on-demand
- lean towards being proactive rather than reactive and measure growth and trends
- watch the procurement process closely lest it come back to bite you
5. Setup Monitoring and Metrics
- see trends over time
- spot application trouble and bottlenecks
- determine if your tuning efforts are paying off
- review a traffic spike after the fact
The cloud is not a silver bullet that can automatically scale any web application. Software design is still a crucial factor. Baking in these features with the right flexibility and foresight, and you’ll manage your websites growth patterns with ease.
Have questions or need help with scalability? Call us: +1-212-533-6828
On the business side we’ve all seen requests for hardware purchases that seem astronomical, or somehow out of proportion to the project at hand. And on the IT side we’ve been faced with the challenge of selling capital expenditures on technology, as demands grow.
Collecting statistics on real usage of server systems, and then connecting the dots to business metrics is an excellent way to bridge the gap. This allows IT to draw concrete connection between technology investment, and reaching business goals.
Metrics and drawing the dotted line in this way also educates folks on both sides of the tracks. It educates technologists on exactly how technology purchases can be justified, by their direct return to the business. And it educates finance and business executives on how those hardware purchases directly contribute to business growth.