Top Banner
57

Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Dec 21, 2015

Download

Documents

Kenneth Kelly
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Appserver & DBServer Database Server App Server Throw more RAM and CPU.
Page 2: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Best Practices for Scaling Web AppsChander Dhall

DEV-B318

Page 3: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

EM OFC WIN DBI

CDP TWC DEV AZR

Following this session at 18:30

in Hall 5Meet with Microsoft Product ExpertsSnacks and Beverages Served

Ask The Experts Key and floorplan

Cloud and Datacenter Platform

Data Platform and Business Intelligence

Developer Platform and Tools

Enterprise Mobility

Office 365

Windows

Microsoft Azure

Trustworthy Computing

Page 4: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

AgendaWhy 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

}

Page 5: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Why?

Amazon claim – Just an extra 1/10th 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.

Page 6: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Why is Scalability Important

The website was working great UNTIL we launched

Instagram was down the day they launched it

Page 7: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

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

Performance – Optimal utilization of resources

Responsiveness – Time taken per operation

Availability – Probability of the application being available at any given point in time

Downtime Impact - The impact of a downtime of a server/service/resource - number of users, type of impact etc

Page 8: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Section 1: CAP

Chander Dhall

Page 9: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Brewer’s CAP Theorem

Consistency (or more appropriately Atomic)AvailabilityPartition Tolerance

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

Page 10: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Fallacies of Distributed Computing

Network is reliable. Latency is zero. Bandwidth is infinite. Network is secure. Topology doesn’t change. There is one administrator.

Page 11: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Fallacies of Distributed ComputingTransport cost is zero. Network is homogenous.

Page 12: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Section 2: Failed ArchitectureChander Dhall

Page 13: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Getting StartedAppserver & DBServer

Database ServerApp Server

Page 14: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Next Gen – Vertical Scaling

Appserver & DBServer

Database Server

App Server

Throw more RAM and CPU

Page 15: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Vertical Partitioning (Services)

App Server

Db Server

Page 16: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Horizontal ScalingLoad Balancer

DB Server

Page 17: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Unfortunate Solution

Load Balancer

S ServicesS S S S

Web Web Web

Database

Page 18: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Section 3: Less Scalable SolutionChander Dhall

Page 19: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Sticky Sessions

Load Balancer

User 1

Page 20: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Central Session Store

Load Balancer

Session Store

APP

SERVER

Page 21: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Clustered Session Management

Load Balancer

Page 22: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Load Balanced App Server Cluster

Load Balancer

Users

Load Balancer

Page 23: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Vertical Partitioning (Hardware)Load Balancer Load Balancer

DB Server SAN

Page 24: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Horizontal Scaling (DB)

Load Balancer Load Balancer

DB Server SAN

Page 25: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Horizontal Scaling (DB)

Load Balancer Load Balancer

DB Server SANDB Server DB Server

DB Replica

Page 26: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Vertical / Horizontal Partitioning (DB)

Load Balancer Load Balancer

DB Server SANDB Server DB Server

DB Cluster

Page 27: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Vertical / Horizontal Partitioning (DB)

App Cluster

Db Cluster 1 Db Cluster 2Twitter Table

Facebook Table

Users Table

Products Table

Vertical Partitioning

Page 28: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Vertical / Horizontal Partitioning (DB)

App Cluster

Db Cluster 1 Db Cluster 2Twitter Table

Facebook Table

Twitter Table

Facebook Table

Horizontal Partitioning

0-1 Million Users 1-2 Million Users

Page 29: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Step 7 – Vertical / Horizontal Partitioning (DB)

Load Balancer

DB

DB ClusterDB DB DB DB DB

DB Cluster

Hash Map

SAN

Page 30: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

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

Map

Page 31: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Caching

Add caches within App ServerObject CacheSession CacheAPI cachePage cache

SoftwareMemcachedRedis Azure Cache (App Fabric)

Page 32: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

HTTP AcceleratorA 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 ServerIntelligent load balancing

Page 33: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

More Important StuffCDNsIP AnycastingAsync Nonblocking IO (for all Network Servers)If possible - Async Nonblocking IO for diskIncorporate multi-layer caching strategy where required

L1 cache – in-process with App ServerL2 cache – across network boundaryL3 cache – on disk

Grid computing

Page 34: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Demo

Page 35: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

Section 4: Finalizing using Polyglot PersistenceChander Dhall

Page 36: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

NoSql Vs Relational

0 2000 4000 6000 8000 10000 12000 14000 160000

2000

4000

6000

8000

10000

12000

14000

Key Value

Mem-cached

Relational Data-bases

Doc-umen

t Databases

Depth of Functionality Sca

labili

ty a

nd P

erf

orm

ance

Page 37: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

FinalizingLoad Balancer

DB

DB

DB

DB Cluster

Hash

Map

DB

DB

DB

DB ClusterMaste

r

Slave Slave

SANDocument/Graph No Sql

Master

Slave Slave

Search Db

Caching Offline

processing/Queuing

Load Balancer

Page 38: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

4. Using No-Sql in the right way

Page 39: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

NoSql Paradigm - Atomic Aggregates

AccountIdAccount No.

CheckingIdMin bal

SavingsIdInterest rate

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

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

Page 40: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

No sql paradigm – Index tableEmployee Id

Details

1234 Email: [email protected]; State: CA; Dept: IT

8235 Email: [email protected]; State: TX; Dept: Sales

2234 Email: [email protected]; State: AL; Dept: IT

1671 Email: [email protected]; State: WA; Dept: SalesStat

eEmployee Id

CA 1234, 1235, 1236, 1244

TX 8000, 8100, 8235, 8266

AL 2212, 2221, 2234, 2256

Dept Employee Id

IT 1234, 1235, 1236, 1244

Sales 8000, 8100, 8235, 8266

Acc 2212, 2221, 2234, 2256

Page 41: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

No sql paradigm – Tree Index

Country - USA

State - CA

City - LA

Properties

Facilities

{“property”: [{ “facilityName”: abc”, “facilityId”:”111”},{“facilityName”:”xyz” , “facilityId”:”222”}]}

Page 42: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

No sql paradigm – Composite Key

Dept= IT:* orDept= Sales:Online:*

IT: Software: 1123

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

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

EmpName: Matt; Address: San FranciscoSales: Online:

832EmpName: Katie: Address: Austin, Tx

Sales : Online: 423

EmpName: Karen: Address: Irvine, CASales : Store : 556

EmpName: Richard; Address: San Diego

ITEmployees

SalesEmployees

EMPLOYEES

Page 43: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

No sql paradigm - Grouping

U123: O111 Product Ids: [“Surface”, “xbox”]

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

U124:O234 Product Ids: [“Win phone”, “surface”]

U124:O999 Product Ids: [“office”, “azure sub”]

U125:O789 Product Ids: [“msdn”, “office”]

U125:O945 Product Ids: [“surface”, “xbox”]

Colocation of a users’ data.

Page 44: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

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

Page 45: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

No sql paradigm – Materialized paths

Electronics

TV Phones Computers Cameras

Samsung Apple LG

LCD LED

Page 46: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

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”}

Page 47: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

No sql paradigm – Nested sets

Electronics

TV Phones

Samsung Sony Cell Landline1 2 3 4 5 6 7 8 9 10 11 12 13 14

Page 48: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

No sql paradigm – Nested sets

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

Sony Samsung

TV

LandlineCell

Phone

Electronics

Page 49: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

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:expert

Page 50: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

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”}

Page 51: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

References http://www.couchbase.com/why-nosql/nosql-databaseHighly scalable blog. http://redis.io/http://Cassandra.apache.orghttp://elasticsearch.orghttp://memcached.org/Building Scalable Architecture

Page 52: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

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)

Page 53: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

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

Page 54: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

http://www.visualstudio.com

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

http://msdn.microsoft.com/vstudio

DEV Track Resources

visualstudio

@visualstudio

visualstudio

Page 55: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

EM OFC WIN DBI

CDP TWC DEV AZR

Following this session at 18:30

in Hall 5Meet with Microsoft Product ExpertsSnacks and Beverages Served

Ask The Experts Key and floorplan

Cloud and Datacenter Platform

Data Platform and Business Intelligence

Developer Platform and Tools

Enterprise Mobility

Office 365

Windows

Microsoft Azure

Trustworthy Computing

Page 56: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

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!

Page 57: Appserver & DBServer Database Server App Server Throw more RAM and CPU.

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