SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

45
7 Key Things for Building a Highly-Scalable SharePoint 2013 App #SPSSTHLM08 Edin Kapić January 25 th , 2014 SharePoint Saturday Stockholm

description

Learn best practices and patterns to build your next super-scalable SharePoint 2013 App. You will see how to pair the power of the browser and the cloud to build a SharePoint app that runs like a cheetah. We will go in depth on how the modern SharePoint 2013 app is built on Windows Azure, demo and learn how to manage the different mechanisms for scaling that are available to us, such as non-relational databases, cache, asynchronous API calls and queuing. You will take away code samples and guidance that will enable you to scale you next SharePoint 2013 app.

Transcript of SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Page 1: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

7 Key Things for Building a Highly-Scalable SharePoint 2013 App

#SPSSTHLM08Edin KapićJanuary 25th, 2014

SharePoint Saturday

Stockholm

Page 2: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Thanks to our sponsors!

SharePint

Silver

Bronze

Raffle

Platinum

Gold

Page 3: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Works for Spenta / Beezy in Barcelona

SharePoint Server MVP

President of Catalonian SharePoint User Group (SUG.CAT)

Edin Kapić

[email protected]

I wonder if this beer could be

SharePint compatible

Page 4: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Scalability[skeɪləˈbɪlɪtɪ] n, the ability of something to adapt to increased demands

4

Page 5: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Hey boss, we have 1M new users for our web app!!...and they all sign up tomorrow!

Scalability

Page 6: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Scalability

Not scalable Scalable

Page 7: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Scalability

#FAIL

Page 8: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Scalability

#COOL

Page 9: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

SharePoint 2013 Apps Architecture

Page 10: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

SharePoint 2013 Application Architecture SharePoint 2013 Apps are cloud-based

Page 11: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

SharePoint is now just another external system

Minimize round trips

Page 12: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

What can we learn from Star Wars?...beyond who is Luke’s father...

Page 13: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

13

With the cloud, we have potential for scalability and high

availability

But the architecture must enable it

(It doesn’t come out of the box)

Page 14: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

I assure you, Emperor, that this Death Star

has been designed to withstand any attack.

Page 15: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App
Page 16: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

I find your lack of failover

disturbing…

Page 17: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Now back to our regular programme

Page 18: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

SharePoint 2013 Application Architecture

Page 19: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Session Overview Avoiding Roundtrips

Effective Caching Mechanisms Content-Delivery Networks

Avoiding Bottlenecks Avoiding Storage Locks Waiting in a Queue is Not Bad Acting Asynchronously

Avoiding Single Point of Failure Redundant Design

SUM

MARY

Page 20: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

SharePoint 2013 Application Architecture

Page 21: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Effective Caching Mechanisms

Page 22: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Effective Caching Mechanisms Caching is the cheapest way to avoid unnecessary roundtrips

Local Cache Small, static data, very frequently

accessed

Distributed Cache Everything that you reasonably can

Stale Data

Page 23: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Content Delivery Networks (CDN)

Page 24: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

• Big binary storage in the cloud

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

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

BLOB Storage

Page 25: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Content Delivery Networks (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

Page 26: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Avoiding Storage Locks

Page 27: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Click to insert photo.

Storage Locks

(in essence)

Page 28: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Avoiding Storage Locks

RDBMS vs NoSQL SQL Azure vs Table Storage

Immediate Consistency vs Eventual Consistency. ..

Page 29: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Avoiding Storage Locks

Sharding Partition your data across

multiple databases or storages

JOINs across shards

SQL Azure Federations

Shards

A-F

G-O

P-Z

Data Access

Partition Keys

Page 30: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Avoiding Storage Locks

Command-Query Responsibility Segregation(CQRS)

30

Source: Udi Dahan

Page 31: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Waiting in a Queue is Not Bad

Page 32: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Waiting in a Queue is Not Bad Request/Response doesn’t scale well

By queuing the requests we have control

To decouple the request and the response To do retries and accomodate node loss To throttle the rate of service To scale up and down depending on the workload

Web Back-End

Message Queue

Page 33: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Waiting in a Queue is Not Bad

Azure Queues

Low-Level

Pass messages between roles and sites

Fully decoupled R/W operations Automatic Load Balancing

Azure Service Bus Queues

High-Level

Messaging framework with queues

Publisher-Subscriber Transactions

Page 34: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Waiting in a Queue is Not Bad

my-account

Submit-queue

Joe’s Job

Mary’s Job

Calc-queue

Andy’s Job

Storage Account

Queue

Message

Azure Queues

Submitter

Processer

Page 35: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Acting Asynchronously

Page 36: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Mr. Sync and Mr. Async

(and a customer)

Page 37: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Web Tier

DataTier

Acting Asynchronously We can optimize the server throughput with async calls to the next tier

Just got easier in NET 4.5 with async/await

Web Tier

Thread#1

DataTier

Request 1

Response 1

Request 2

Thread#1

Request 1

Response 1

Request 2

Page 38: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Redundant Design

Page 39: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

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

Although some delay is OK

Idempotent operations Load-balancing

Image: Rainer Knäpper, License: artlibre

Page 40: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Redundant Design Azure Traffic Manager

Page 41: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Redundant Design

Page 42: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Summary

Page 43: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

7 Key Things for Building a Highly-Scalable SharePoint App1. Caching2. Content Delivery Network / BLOB Storage3. NoSQL4. Sharding5. Queuing6. Asynchronous Processing7. Redundant Design

SUM

MARY

Page 44: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

Additional Resources High Scalability

http://highscalability.com/

Advanced Patterns in Cloud-Hosted Apps for Microsoft SharePoint http://

channel9.msdn.com/Events/TechEd/NorthAmerica/2013/SES-B301

Page 45: SPS Stockholm 7 Key Things for Building a Highly-Scalable SharePoint 2013 App

...and visit our sponsors who made this day possible!

Thank you!

Please rate this session...