spca2014 7 tenets of highly scalable applications kapic

54

Upload: nccomms

Post on 14-Jul-2015

73 views

Category:

Documents


1 download

TRANSCRIPT

7 Tenets of Highly-Scalable Applications

Edin Kapić

Beezy

Kapić

• SharePoint Architect• Works for Spenta / Beezy in

Barcelona, Spain

• SharePoint Server MVP

• President of Catalonian SharePoint User Group (SUG.CAT)

• Pluralsight Author

• Spreekt een beetje nederlands ;-)

sug.cat @ekapic

www.edinkapic.com

scalability[skeɪləˈbɪlɪtɪ]

n, the ability of something to adapt to increased demands

Scalability

Scalability (answered)

Non-scalable Scalable

Scalability #fail

Scalability #fail

Scalability #awesome

Week 1 Week 2 Week 3 Week 4 Week 5 Week 6 Week 7

Drawings/second 0 3 50 333 1660 3000 5400

Total drawings (M) 0 5 12 50 500 1000 2200

R/W latency (ms) 0 0,5 0,5 0,6 0,7 0,7 0,9

Servers 6 6 6 18 54 72 90

With the cloud, potential scalability you have…

…but architect for it you must…

…out of the box it comes not.

Photo Credit: JD Hancock

http://www.flickr.com/photos/83346641@N00/5813423429

http://creativecommons.org/licenses/by/2.0/

Photo Credit: Brian Neudorffhttp://www.flickr.com/photos/14125773@N00/6821487081http://creativecommons.org/licenses/by/2.0/

Photo Credit: JD Hancockhttp://www.flickr.com/photos/83346641@N00/3618602355http://creativecommons.org/licenses/by/2.0/

SharePoint 2013 app architecture

SharePoint 2013 scalable apparchitecture

3 Guidelines, 7 Tenets

• Avoiding Roundtrips1. Effective caching mechanisms

2. Content-Delivery Networks and BLOB storage

• Avoiding Bottlenecks3. NoSQL storage

4. Sharding

5. Waiting in a queue

6. Acting asynchronously

• Avoiding Single Point of Failure7. Redundant Design

SharePoint 2013 scalable apparchitecture

Effective caching mechanisms

• Caching is the cheapest way to avoid unnecessary roundtrips

• Stale data

Local and distributed cache

• Local cache• Small, static data,

very frequently accessed

• Distributed cache• Everything that you

reasonably can

Azure Cache(s)

• In-Role Cache• AppFabric caching in your local

machine

• Redis Cache• General purpose caching with rich

API

• Managed Cache

Domain Name System (DNS)

• Example of effective cache mechanism

BLOB storage

• Big binary storage in the cloud

• Bypass the Processing• Public BLOBs can be accessed by URL

• Shared Signatures• Private BLOBs can be accessed by a special URL

Content delivery network (CDN)

• Big binary storage close to the user• No need to serve from the cloud

• First user pays the “toll”, others get it free

• Offload• Images

• Scripts

• Media Files

• Versioned URLs

Storage lock(defined)

Storage types

RelationalSQL Azure

Immediate Consistency

Document/NoSQLTable Storage

Eventual Consistency

CQRS

• Command-Queryresponsibilitysegregationpattern

• Used in SharePoint CSWP

Sharding

• Partition your data across multiple databases or storages

• JOINs across shards

• SQL Azure FederationsShards

A-F

G-O

P-Z

Data Access

Partitionkeys

Photo Credit: Guiseppe Milo http://www.flickr.com/photos/87690240@N03/10658478643

Queuing benefits

Decoupling

Retries and node failure recoveryThrottling and DDOS prevention

Autoscaling

Web Back-End

Message Queue

Azure queues

Azure Storage queues

• Low-Level

• Pass messages between roles and sites

• Fully decoupled R/W operations

• Automatic Load Balancing

Service Bus queues

• High-Level

• Messaging framework with queues

• Publisher-Subscriber

• Transactions

Azure storage queue anatomy

Mr. Sync andMr. Async

(waiters)

Acting asynchronously

• We can optimize the server throughput with asynccalls to the next tier

• Just got easier in NET 4.5 with async/await

Web Tier

DataTier

Web Tier

Thread#1

DataTier

Request 1

Response 1

Request 2

Thread#1

Request 1

Response 1

Request 2

• Asynchronous processing

Redundant design

• If any single node goes down, your app must continue unhindered

• Some delay is acceptable

• Idempotent operations

• Load-balancing

Image: Rainer Knäpper, License: artlibre

Azure Traffic Manager

Redundant design example

SharePoint 2013 scalable apparchitecture

3 Guidelines, 7 Tenets

• Avoiding Roundtrips1. Effective caching mechanisms

2. Content-Delivery Networks and BLOB storage

• Avoiding Bottlenecks3. NoSQL storage

4. Sharding

5. Waiting in a queue

6. Acting asynchronously

• Avoiding Single Point of Failure7. Redundant Design

Additional resources

• Scalability Rules: 50 Principles for Scaling Web Sites• Martin L. Abbott, Michael T. Fisher

• High Scalability• http://highscalability.com/

• Ongoing Demo Scalable App• https://bitbucket.org/ekapic/scalable-

app

Questions? Vragen?

@ekapic

[email protected]

www.edinkapic.com