True story of re architecting website for scale on windows azure

Preview:

DESCRIPTION

 

Citation preview

True story of re-architecting website for scale on Windows AzureSergejus Barinovas@sergejusb | bebetterdeveloper.com

1,3 billion+ web transactions / day

3 datacenters / 300+ servers

BACKGROUND

Lithuanian-based startup

20K+ unique visitors per month

can go viral any day soon

A STORY…

INITIAL ARCHITECTURE

HOSTING WINDOWS AZURE

website, blogstatic content

database

photos

Linux | Apache | MySQL | PHP

Linux | Nginx | FTP

~260K page views / month

~9K page views / day

~1K page views / hour

~0,2 page views / second

IS 20K+ UNIQUE VISITORS A LOT?

but spikes up-to

50 page views / second

Cloud gives more flexibility and scalability options

Windows Azure is Microsoft’s Cloud Platform

BizSpark gives Windows Azure for free for 1 year

Let’s move!

MOTIVATION

WINDOWS AZURE VIRTUAL MACHINE

Windows Server or Linux

Attachable storage

Scaling and load balancing

Virtual private network

BEFORE

HOSTING WINDOWS AZURE

website, blogstatic content

database

photos

Linux | Apache | MySQL | PHP

Linux | Nginx | FTP

AFTER

WINDOWS AZURE

website, blogstatic content

database

photos

Linux | Apache | MySQL | PHP

Linux | Nginx | FTP

Dedicated VM for storing content is suboptimal in

the cloud

Manual management & scaling

No backups

SCALING ISSUE #1

WINDOWS AZURE BLOB STORAGE

Highly available (3 copies) and

scalable

Can be exposed publically over

HTTP

Geo-replication across datacenters

9+ trillion objects

BEFORE STEP #1

WINDOWS AZURE

website, blogstatic content

database

photos

Linux | Apache | MySQL | PHP

Linux | Nginx | FTP

AFTER STEP #1

WINDOWS AZURE

website, blogstatic content

database

photos

Linux | Apache | MySQL | PHP

HTTP

Static content on the same VM as website and

blog

Different scalability targets

Photos are part of static content

SCALING ISSUE #2

BEFORE STEP #2

WINDOWS AZURE

website, blogstatic content

database

photos

Linux | Apache | MySQL | PHP

HTTP

AFTER STEP #2

WINDOWS AZURE

website, blogdatabase

static content

Linux | Apache | MySQL | PHP

HTTP

Database on the same VM as website and blog

Very different scalability targets and strategies

SCALING ISSUE #3

BEFORE STEP #3

WINDOWS AZURE

website, blogdatabase

static content

Linux | Apache | MySQL | PHP

HTTP

AFTER STEP #3

WINDOWS AZURE

database static content

Linux | MySQL HTTP

website, blog

Linux | Apache | PHP

Blog on the same VM as website

Different scalability targets

SCALING ISSUE #4

WINDOWS AZURE WEBSITES

Cloud hosting

ASP.NET, Node.js or PHP runtimes

Git, Dropbox, TFS, VS, etc.

deployment

Auto-scaling

BEFORE STEP #4

WINDOWS AZURE

database static content

Linux | MySQL HTTP

website, blog

Linux | Apache | PHP

AFTER STEP #4

WINDOWS AZURE

database static content

Linux | MySQL HTTP

website

Linux | Apache | PHP

blog

IIS | PHP

FURTHER SCALING

strategy for the future

Website gets more requests than can handle

SCALING ISSUE #5

BEFORE STEP #5

WINDOWS AZURE

database static content

Linux | MySQL HTTP

website

Linux | Apache | PHP

blog

IIS | PHP

BEFORE STEP #5

WINDOWS AZURE

database static content

Linux | MySQL HTTP

website

Linux | Apache | PHP

blog

IIS | PHP

Database gets more queries than can handle

SCALING ISSUE #6

BEFORE STEP #6

WINDOWS AZURE

database static content

Linux | MySQL HTTP

website

Linux | Apache | PHP

blog

IIS | PHP

AFTER STEP #6

WINDOWS AZURE

read-onlydatabase

static content

HTTP

website

Linux | Apache | PHP

blog

IIS | PHP

write-onlydatabase

Linux | MySQL

Linux | MySQL

Read-only database gets more queries than can

handle

SCALING ISSUE #7

BEFORE STEP #7

WINDOWS AZURE

read-onlydatabase

static content

HTTP

website

Linux | Apache | PHP

blog

IIS | PHP

write-onlydatabase

Linux | MySQL

Linux | MySQL

AFTER STEP #7

WINDOWS AZURE

read-onlydatabase

static content

HTTP

website

Linux | Apache | PHP

blog

IIS | PHP

write-onlydatabase

Linux | MySQL

Linux | MySQL

Write-only database gets more queries than can

handle

SCALING ISSUE #8

This is a nice issue to have

Split write-only database into shards with multiple

read-only slaves for each shard accessed via layer

of distributed cache

IN SHORT

DEMO

scaling bebetterdeveloper.com

ARCHITECTURE

WINDOWS AZURE

database static content

SQL Database

HTTP

blog

IIS | PHP

DB

WINDOWS AZURE SERVICES

Windows Azure Virtual Machine for VMs

Windows Azure Blob Storage for static content

Windows Azure Website for hosting web site

DISCUSSED WINDOWS AZURE SERVICES

Windows Azure Service Bus for messaging

Windows Azure Cache Service for distributed

caching

Windows Azure Notification Hubs for push

notification

Windows Azure HDInsight for big data

OTHER WINDOWS AZURE SERVICES

FULL LIST OF WINDOWS AZURE SERVICES

DATA SERVICES

SQL Database

Storage

HDInsight

Cache

Backup

Recovery

Manager

APP SERVICES

Media Services

Service Bus

Notification Hubs

BizTalk Services

Active Directory

Multi-Factor Auth

NETWORK

SERVICES

Virtual Network

Traffic Manager

COMPUTE

Virtual Machines

Web Sites

Mobile Services

Cloud Services

Pricing calculator: http://www.windowsazure.com/en-us/pricing/calculator/?

scenario=full

HAPPY SCALING!Sergejus Barinovas@sergejusb | bebetterdeveloper.com

 

Q&A

Recommended