/
Best Practices for Scaling Web Apps Best Practices for Scaling Web Apps

Best Practices for Scaling Web Apps - PowerPoint Presentation

lindy-dunigan
lindy-dunigan . @lindy-dunigan
Follow
363 views
Uploaded On 2018-03-19

Best Practices for Scaling Web Apps - PPT Presentation

Chander Dhall DEVB318 EM OFC WIN DBI CDP TWC DEV AZR Following this session at 1830 in Hall 5 Meet with Microsoft Product Experts Snacks and Beverages Served Ask The Experts Key and ID: 657400

balancer load microsoft server load balancer server microsoft cluster http app sql dept table cache paradigm horizontal partitioning san

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Best Practices for Scaling Web Apps" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1
Slide2

Best Practices for Scaling Web Apps

Chander Dhall

DEV-B318Slide3

EM

OFC

WIN

DBI

CDP

TWC

DEV

AZR

Following this session at 18:30

in

Hall

5

Meet with Microsoft Product

ExpertsSnacks and Beverages Served

Ask The Experts

Key and

floorplanCloud and Datacenter PlatformData Platform and Business IntelligenceDeveloper Platform and ToolsEnterprise Mobility

Office 365Windows Microsoft AzureTrustworthy ComputingSlide4

Agenda

Why is it important to scale?

Creating a scalable solution (in incremental steps

)

While (Not Fixed) {

Propose an ArchitectureIdentify Failures and BottlenecksIdentify DowntimeApply a better solution }Slide5

Why?

Amazon claim – Just an extra 1/10

th

of a second on their response times will cost them 1% in sales.Google – ½ a second increase in latency caused traffic to drop by a fifth. Slide6

Why is Scalability Important

The website was working great

UNTIL we launched

Instagram was down

the day they launched itSlide7

Concepts

Scalability

-

Number of users / sessions / transactions / operations the entire system can handle

Performance –

Optimal utilization of resources Responsiveness – Time taken per operationAvailability – Probability of the application being available at any given point in timeDowntime Impact - The impact of a downtime of a server/service/resource - number of users, type of impact

etcSlide8

Section 1:

CAP

Chander DhallSlide9

Brewer’s CAP Theorem

Consistency (or more appropriately Atomic)

Availability

Partition Tolerance“No set of failures less than total network failure is allowed to cause the system to respond incorrectly” – Gilbert & LynchSlide10

Fallacies of Distributed Computing

Network is reliable. Latency is zero.

Bandwidth is infinite.

Network is secure. Topology doesn’t change. There is one administrator. Slide11

Fallacies of Distributed Computing

Transport cost is zero.

Network is homogenous. Slide12

Section 2:

Failed Architecture

Chander DhallSlide13

Getting Started

Appserver

&

DBServer

Database Server

App ServerSlide14

Next Gen – Vertical Scaling

Appserver

&

DBServer

Database Server

App Server

Throw more RAM and CPU

Slide15

Vertical Partitioning (Services)

App

Server

Db ServerSlide16

Horizontal Scaling

Load Balancer

DB ServerSlide17

Unfortunate Solution

Load Balancer

S

Services

S

S

S

S

Web

Web

Web

DatabaseSlide18

Section 3:

Less Scalable Solution

Chander DhallSlide19

Sticky Sessions

Load Balancer

User 1Slide20

Central Session Store

Load Balancer

Session Store

A

P

P

S

E

R

V

E

RSlide21

Clustered Session Management

Load BalancerSlide22

Load Balanced App Server Cluster

Load Balancer

Users

Load BalancerSlide23

Vertical Partitioning (Hardware)

Load Balancer

Load Balancer

DB Server

SANSlide24

Horizontal Scaling (DB)

Load Balancer

Load Balancer

DB Server

SANSlide25

Horizontal Scaling (DB)

Load Balancer

Load Balancer

DB Server

SAN

DB Server

DB Server

DB ReplicaSlide26

Vertical

/ Horizontal Partitioning (DB)

Load Balancer

Load Balancer

DB Server

SAN

DB Server

DB Server

DB ClusterSlide27

Vertical

/ Horizontal Partitioning (DB)

App Cluster

Db Cluster 1

Db Cluster 2

Twitter Table

Facebook Table

Users Table

Products Table

Vertical PartitioningSlide28

Vertical

/ Horizontal Partitioning (DB)

App Cluster

Db Cluster 1

Db Cluster 2

Twitter Table

Facebook Table

Twitter Table

Facebook Table

Horizontal Partitioning

0-1 Million Users1-2 Million UsersSlide29

Step 7 – Vertical / Horizontal Partitioning (DB)

Load Balancer

DB

DB

Cluster

DB

DB

DB

DB

DB

DB Cluster

Hash Map

SANSlide30

Separating

Sets

Load Balancer

Load Balancer

DB

DB

DB

DB Cluster

Hash Map

DB

DB

DB

DB Cluster

Load Balancer

Load Balancer

DB

DB

DB

DB Cluster

Hash Map

DB

DB

DB

DB Cluster

Set 1-10 Million Users

Set 11-20 Million Users

Global Redirector

Global Look up Hash MapSlide31

Caching

Add caches within App Server

Object Cache

Session Cache

API cache

Page cache

Software

Memcached

Redis

Azure Cache (App Fabric)Slide32

HTTP Accelerator

A good HTTP Accelerator / Reverse proxy performs the following –

Redirect static content requests to a lighter HTTP server (

lighttpd

)

Cache content based on rules

Use

Async

Non blocking IO

Maintain a limited pool of Keep-alive connections to the App Server

Intelligent load

balancingSlide33

More Important Stuff

CDNs

IP

Anycasting

Async

Nonblocking

IO (for all Network Servers)

If possible -

Async

Nonblocking IO for diskIncorporate multi-layer caching strategy where requiredL1 cache – in-process with App Server

L2 cache – across network boundaryL3 cache – on disk

Grid computingSlide34

DemoSlide35

Section 4: Finalizing using Polyglot Persistence

Chander DhallSlide36

NoSql

Vs Relational

Depth of Functionality

  

Scalability and Performance   Slide37

Finalizing

Load Balancer

DB

DB

DB

DB

Cluster

Hash

Map

DB

DB

DB

DB Cluster

Master

Slave

Slave

SAN

Document/Graph No

Sql

Master

Slave

Slave

Search Db

Caching

Offline processing

/

Queuing

Load BalancerSlide38

4. Using No-

Sql in the right waySlide39

NoSql

Paradigm - Atomic Aggregates

Account

Id

Account No.

CheckingIdMin bal

SavingsIdInterest rate

Account

{

“Type”: “Checking”, “Id”: “chk123”,“Min Bal”:”10000”,}Account{

“Type”: “Savings”, “Id”: “sav123”,“Interest Rate”:”5%”,}Slide40

No sql

paradigm – Index table

Employee Id

Details

1234

Email: a@a.com; State: CA; Dept: IT8235Email: b@b.com; State: TX; Dept: Sales2234

Email: c@c.com; State: AL; Dept: IT1671Email: c@d.com; State: WA; Dept: Sales

StateEmployee IdCA1234, 1235, 1236, 1244

TX8000, 8100, 8235, 8266AL2212, 2221, 2234, 2256

DeptEmployee IdIT

1234, 1235, 1236, 1244Sales8000, 8100, 8235, 8266Acc2212, 2221, 2234, 2256Slide41

No sql

paradigm – Tree Index

Country - USA

State - CA

City - LA

Properties

Facilities

{

“property”:

[{ “facilityName”: abc”, “facilityId”:”111”},

{“facilityName”:”xyz” , “facilityId”:”222”}]}Slide42

No sql

paradigm – Composite Key

Dept

= IT:* orDept= Sales:Online

:*

IT: Software: 1123EmpName: John; Address: Los Angeles

IT: Software: 2323

EmpName: Kevin; Address: Dallas, TX IT: Hardware: 6767

EmpName: Matt; Address: San FranciscoSales: Online: 832

EmpName: Katie: Address: Austin, Tx

Sales : Online: 423EmpName: Karen: Address: Irvine, CA

Sales : Store : 556EmpName

: Richard; Address: San Diego

ITEmployeesSales

Employees

E

MPLOYEESSlide43

No sql

paradigm - Grouping

U123: O111

Product Ids: [“Surface”, “

xbox

”]U124:O123

Product Ids: [“Win 8”, “xbox”]

U124:O234Product Ids: [“Win phone”, “surface”]

U124:O999Product Ids: [“office”, “azure sub”]

U125:O789Product Ids: [“msdn”, “office”]

U125:O945Product Ids: [“surface”, “

xbox”]Colocation of a users’ data.Slide44

Inverted search & direct aggregation

EmpId

,

dept

, city, …….

Dept-IT: [111, 123, 234….]Dept

-Sales:[673, 343, 434….]City: Dallas

City: LA

111: Dept-Sales, City: LA …

222: Dept-IT, City: Dallas ….Slide45

No

sql paradigm – Materialized paths

Electronics

TV

Phones

Computers

Cameras

SamsungApple

LG

LCD

LEDSlide46

No

sql paradigm – Materialized paths

TV

Samsung

Apple

LG

LCD

LED

{ “entity”: “TV”, “

category”:”Electronics

”}{ “entity”: “Samsung”, “category”:”Electronics

, TV”}{ “entity”: “Samsung”, “category”:”Electronics

, TV, LCD”}Slide47

No

sql paradigm – Nested sets

Electronics

TV

Phones

Samsung

Sony

Cell

Landline

1 2 3 4 5 6 7 8 9 10 11 12 13 14Slide48

No

sql paradigm – Nested sets

1 2 3 4 5 6 7 8 9 10 11 12 13 14

Sony

Samsung

TV

Landline

Cell

Phone

ElectronicsSlide49

Flattening nested documents

Name:

Chander

Hadoop

: Expert

Nodejs

: Expert

Spanish: Novice

{“name”:”chander”,“skills”:”hadoop,

nodejs, Spanish”, “level”:”expert, expert, novice”}Skills:hadoop

AND level:expertSlide50

Flattening nested documents

Name:

Chander

Hadoop

: Expert

Nodejs

: Expert

Spanish: Novice

{“name”:”chander”,“skills_1”:”hadoop”,“skills_2”: “

nodejs”,“skills_3”: “spanish”, “level_1”:”expert”,“level_2”: “expert”,“level_3”: “novice”}Slide51

References

http://www.couchbase.com/why-nosql/nosql-database

Highly scalable blog.

http://redis.io/http://Cassandra.apache.orghttp://elasticsearch.orghttp://memcached.org/Building Scalable ArchitectureSlide52

CDP-B235 Architecting Globally Available and Scalable Solutions on Microsoft Azure: An End-to-End View

Related content

Labs

(session codes and titles)

Microsoft Solutions Experience Location (MSE)

Find Me Later At. .

.

Ask the Experts, Hall 5 (6:30-8pm)Slide53

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/TechEdSlide54

http://www.visualstudio.com

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

http://msdn.microsoft.com/vstudio

DEV Track Resources

visualstudio

@

visualstudio

visualstudioSlide55

EM

OFC

WIN

DBI

CDP

TWC

DEV

AZR

Following this session at 18:30

in

Hall

5

Meet with Microsoft Product

ExpertsSnacks and Beverages Served

Ask The Experts

Key and

floorplanCloud and Datacenter PlatformData Platform and Business IntelligenceDeveloper Platform and ToolsEnterprise Mobility

Office 365Windows Microsoft AzureTrustworthy ComputingSlide56

TechEd Mobile app

for session evaluations

is

currently offline

SUBMIT YOUR TECHED EVALUATIONS

Fill out an evaluation via

CommNet Station/PC:

Schedule Builder

LogIn

:

europe.msteched.com/catalog

We value your feedback!Slide57

© 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.