35

Setting expectations and context Architecting for scale – a web app journey to scalability Scaling ‘real-world’ applications

Embed Size (px)

Citation preview

Running a Global Massively Scalable Web Application on Windows Azure Websites

Andrew Westgarth

DEV-B341

Setting expectations and context

Architecting for scale – a web app journey to scalability

Scaling ‘real-world’ applications

Agenda

Why Architect for the cloud?

2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020

Tradi-tonal

0.8836459617691

37

0.8947789366421

05

0.8755669661755

44

0.8491641072483

25

0.8162896408777

16

0.7708549639181

83

0.7140621348672

51

0.6528178951738

71

0.5857269195540

82

0.5136732335019

68

0.4366500194294

99

Mi-grated to IaaS

0.0111853919211

283

0.0281871876412

433

0.0489249042630

153

0.0717565262524

224

0.0954035633128

797

0.1188875173591

27

0.1446623311225

86

0.1664044802972

23

0.1844316323294

22

0.1990613595555

53

0.2106056703761

73

Re-placed to Cloud

0.1051686463097

35

0.1255708011738

73

0.1514539054591

26

0.1823409833004

14

0.2176638528218

36

0.2567806601807

44

0.2998873818902

61

0.3460948146855

04

0.3944837983987

77

0.4441361269300

77

0.4941638755063

7

Net New Cloud

0 0.0261352675538

885

0.0573855861792

176

0.1022283435280

58

0.1711567656782

1

0.2613096599121

81

0.3666084184817

03

0.4918414404442

74

0.6297367585867

64

0.7860913639609

94

0.9624288583587

04

25%

75%

125%

175%

225%

% o

f 2

01

0 A

pp

Portfolio

Who uses Azure Websites?

Web Appsblogs.office.com, blog.surface.com, Skype & Bing dev center, Nokia,

more…

Examples: mobile apps, web APIs, facebook games, many more...

Ready for businessExtremely low to ‘no perceived’ downtime (99.95% - 99.99%)

Performance and (global) low latency

‘Easy’ to manage: DevOps, test, deploy, configure, monitor &

analytics

Massive ScaleMany tens of millions of requests per day (100M or higher)

Peak Request per Second of many thousands (5K – 10K RPS)

Massive Scale & Ready For Business Web Apps

Losing Business

Downtim

e

Slow Site

The ability of a system, (a web site)to handle a growing amount of work (http traffic) in a capable manner, (doesn’t go belly up) or its ability to be enlarged to accommodate that growth

Scalability is:

Source:http://en.wikipedia.org/wiki/Scalability

Scale Up– aka Vertical Scaling

Increase resources capacity within existing node

Scaling Options

Scale Out – aka Horizontal Scaling

Increase resources capacity by adding nodes

Architecting for ScaleA web app’s journey towards

scalability

Level 1 Level 2 Boss Level # of users

>100,000

RPS

>10,000

RPS

>100RPS

A web app’s journey towards scalability

Architecting for ScaleLevel 1: Beginners

Website

Level 1 – Photo Gallery (untouched)

DB

<code>

Content

•Database stored on local disk•Session state stored in local memory•Images stored on local disk*•Statefull Application

*Local disk should be treated as a shared resource in Azure Websites

Session

Level 1 – Photo Gallery (untouched)Scale Testing Results:

Scale Count

Scale Size

Test Duratio

n

Max User

Count

Avg Pages/Se

c

Avg Page Time (sec)

Avg RPS (Visual Studio)

WebSites RPS

Failed Tests

Total Tests

Failed Tests (%)

1 MED 15 2 0.27 1.16 1.77 1 0 77 0.0

1 MED 15 20 1.9 6.5 14.2 18 0 559 0.0

1 MED 15 50 3.48 10.4 39.5 45 1 980 0.1

1 MED 15 80 5.58 12.5 51.5 55 0 1639 0

1 MED 15 120 4.95 22.5 47.8 50 19 1446 1.3

Architecting for ScaleLevel 2: Experts

Level 2 – Horizontally Scalable Photo Gallery

Website

DB

<code>

Content

Session

Move database to cloud (SQL Azure)

Move site content to blob (Azure Storage)

Make site statelessNon-Sticky Session

Horizontal scale Web Tier

Level 2 – Horizontally Scalable Photo GalleryStrategy:

Level 2 – Horizontally Scalable Photo GalleryScale Testing Results

Scale Count

Scale Size

Test Duratio

nMax User

Count

Avg Pages/S

ec

Avg Page Time (sec)

Avg RPS (Visual Studio)

WAWS RPS

Failed Tests

Total Tests

Failed Tests (%)

1 LARGE 15 20 2.91 0.13 23.4 21 0 849 0.0

1 LARGE 15 100 14.4 0.15 232 77 0 4,247 0.0

1 LARGE 15 200 29.2 0.14 966 155 0 8,563 0.0

1 LARGE 15 300 43.6 0.24 2,535 231 0 12,839 0.0

1 LARGE 15 1,000 141 0.67 8,135 735 0 20,591 0.0

3 LARGE 20 1,500 198 1.37 19,855 1297 1 32,763 0.0

3 LARGE 25 2,000 242 2.12 24,896 1547 870 53,496 1.6

Configure Auto ScaleOptimize Website CodeOptimize SQLAdd Cache LayerUse CDN for content, *.js & *.cssLeverage other services

Level 2 – Horizontally Scalable Photo GalleryOther improvements:

Level 1 Level 2 Boss Level # of users

>100,000

RPS

>10,000

RPS

>100RPS

A web app’s journey towards scalability

Architecting for ScaleLevel 3: Like a BOSS!

Level 3 – Globally Scalable Photo GalleryWhen bad things happen to good datacenters

West US

My SiteReplica

(A)

East US

My SiteReplica

(B)

Gaps:Web app is ‘local’ to a single regionImages stored in ‘local’ data centerDatabase in ‘local’ data center

Goals:Active / Active replication across regions

Benefits:Bigger ScaleLower LatencyHigher Uptime and DR

Level 3 – Globally Scalable Photo GalleryMoving towards a global presence

Level 3 – Globally Scalable Photo GalleryArchitecture:

East US

Website

Webjob

West US

Website

Webjob

Level 3 – Globally Scalable Photo GalleryArchitecture:

East US

Website

Webjob

West US

Website

Webjob

Copy images to remote regionsUse queue (CQRS*) to update DBAsynchronous data processing with WebJobsAdd Traffic Manager Controlled and synchronized deployment (Site Slots)

Level 3 – Globally Scalable Photo GalleryStrategy:

* Command Query Responsibility Segregation adds latency and app complexity

West US

Website

Webjob

Using a queue to sync DB access leads to eventual consistency Syncing database works for ‘most’ scenarios Active / Active state is app dependent

Level 3 – Globally Scalable Photo GalleryWords of Caution:

West US

Website

Webjob

Level 1 Level 2 Boss Level # of users

>100,000

RPS

>10,000

RPS

>100RPS

A web app’s journey towards scalability

Architecting for ScaleMassive Scale WordPress

Azure Websites can scale to answer all you

business scale needs.

With Azure Websites your websites is

always running (no perceived downtime…)

Azure Websites has rich core functionality

It is easy to develop and maintain my Azure

Website

Summary

You can always reach me here:Twitter: @apwestgarthEmail: [email protected]

Don’t go! I have more questions!

Resources

Learning

Microsoft Certification & Training Resources

www.microsoft.com/learning

Developer Network

http://developer.microsoft.com

TechNet

Resources for IT Professionals

http://microsoft.com/technet

Sessions on Demand

http://channel9.msdn.com/Events/TechEd

http://www.visualstudio.com

http://blogs.msdn.com/b/developer-tools/

http://msdn.microsoft.com/vstudio

DEV Track Resources

visualstudio

@visualstudio

visualstudio

TechEd Mobile app for session evaluations is currently offline

SUBMIT YOUR TECHED EVALUATIONSFill out an evaluation via

CommNet Station/PC: Schedule Builder

LogIn: europe.msteched.com/catalog

We value your feedback!

© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.