Sei sulla pagina 1di 34

SQL Services: Tips and Tricks 

for
High-Throughput
Data-Driven Applications
 David Robinson
Senior Program Manager
Microsoft Corporation
Our Mission
And yes, we need to accept it…

Develop a news posting application that


has the following characteristics
 Extremely scalable
 High performing
 Manage large volumes of data
 Low CapEx/OpEx
 Silverlight 2.0
And…
You have no hardware budget
We Can’t Let Our Fearless Leader Down
Agenda
How will we accomplish our mission?
We Need
 Data modeling and partitioning
 Parallel query processing
 Concurrency
 Utilizing a middle tier
 Support for batch processing
Azure Services Platform
Microsoft Microsoft
Dynamics CRM SharePoint
Services Services
Data Model And ACE Concepts

Authority Container Entity


 Unit of  Unit of  Unit of Storage
geo-location Consistency 
and billing Property Bag
 Scope for of Name/
 Tied to Query and Value pairs
DNS name Update  No Schema
 Collection  Collection Required
of Containers of Entities
Data Modeling and Partitioning
It’s not much different than what you are used to
 Static System Data (low # of deltas)
Lookups
Static Content
Tags

 User Data (medium # of deltas)


User Profiles
User Preferences

 Application Data (high # of deltas)


Content Postings
Wikis
Comments
User to User Interactions
Data Modeling and Partitioning
Entities and kinds
Our application requires
more RDBMS features like
JOINS, TAKE, and ORDER BY

Comment
Posting
Rating
Tags

BONUS!!!
All fields are automatically indexed
Join in SQL

select p.*

from Posting p,
PostingTag t,
Tag m

where p.Id = t.PostingId and


t.TagId = m.Id and
m.Tag = "STRATA"
Join in SLINQ

from p in entities.OfKind(“Posting”)
from t in entities.OfKind(“Tag”)
from m in entities.OfKind(“PostingTag”)

where

p.Id == t.Properties["PostingId"] &&


t.Properties["TagId"] == m.Id &&

m.Properties["Tag"] == “AZURE"

select p
Data Modeling and Partitioning
How does SQL Data Services store our data?

Containers are scoped to


individual backend nodes

General Rule of Thumb


Spread your
data across
multiple
containers
for best
performance
Data Modeling and Partitioning
How does SQL Data Services store our data?

Static System Data (1 Container)

User Data (36 Containers)

Application Data – Remaining Containers


Data Modeling and Partitioning
Takeaways
 Containers are scoped to nodes
in the SDS backend
 Spread your data out amongst many
containers for best performance
 Modeling your data via Entities
is not much different than modeling
with a traditional RDBMS
Agenda
How will we accomplish our mission?
 Data modeling and partitioning ü
 Parallel Query Processing
Parallel Query Processing
How does data access in SQL Data Services work?

All queries
are processed
via the SDS
Front Ends

General Rule of Thumb


Process your
queries in
parallel
for best
performance
demo
Parallel Query
Processing
Parallel Query Processing
Takeaways
 SQL Data Services operations are
processed by the front end servers
 For best performance multithread
your calls to take advantage of the
many front end servers
Agenda
How will we accomplish our mission?
 Data modeling and partitioning ü
 Parallel query processing ü
 Concurrency
Concurrency
How do we handle multiple updates?
SQL Data Services provides
immediate consistency
Lets consider when two users attempt
to update the same record…

ViewCount++ ViewCount++
Posting 123
ViewCount = 134

This is easily handled


in SQL Data Services
Concurrent Operations in SDS

SOAP
Scope myEntityScope = new Scope();
myEntityScope.EntityId = "AwesomePosting";
myEntityScope.VersionMatch.Version = 134;
myEntityScope.VersionMatch.MatchType =
VersionMatchType.Match;

REST
WebRequest request =
HttpWebRequest.Create(entityUri);
request.Method = "POST";
request.Headers
[HttpRequestHeader.IfMatch] = "134";
Concurrency
Key takeaways
 SDS provides an immediate
consistency model
 Use appropriate versioning semantics
to prevent unwanted data overwrites
 MatchType property in SOAP
 IfMatch header in REST
Agenda
How will we accomplish our mission?
 Data modeling and partitioning ü
 Parallel query processing ü
 Concurrency ü
 Caching in our middle tier
Utilizing a Middle Tier

Using a middle tier is nothing new


but wait…

Don’t forget you


have no hardware
budget…
demo
Windows Azure
Service Hosting
Utilizing a Middle Tier
Key takeaways
 Nothing new to learn to host your services
in Windows Azure
 By using Windows Azure, your middle tier is
located closer to your data
 Caching helps combat the latency
associated with cloud based data services
Agenda
How will we accomplish our mission?
 Data modeling and partitioning ü
 Parallel query processing ü
 Concurrency ü
 Caching in our middle tier ü
 Support for batch processing
Support for Batch Processing
How do we queue items to be processed?
After someone creates certain types of postings, additional
processing needs to be done before posting is made live.

This is easily handled with .NET Services


demo
.NET Service Bus
Support for Batch Processing
Key takeaways
 Large, complex applications can benefit
from offline batch processing
 .NET Service Bus is an ideal way of enabling
queuing and offline processing
Agenda
How will we accomplish our mission?
 Data modeling and partitioning ü
 Parallel query processing ü
 Concurrency ü
 Caching in our middle tier ü
 Support for batch processing ü

Mission Accomplished !!!


With all these tips and tricks,
what can we build?
demo
Cloud 9
Related Sessions
Code Title Room Time

BB23 SQL Data Services : A Lap Around 502A 10/28/2008 3:30PM-4:45PM

BB03 SQL Data Services : Under the Hood 404A 10/30/2008 8:30AM-9:45AM

BB14 SQL Data Services: Futures 408B 10/29/2008 10:30AM-11:45AM

BB52 SQL Data Services: Tips and Tricks for High-Throughput Data-Driven Applications 411 10/28/2008 12:45PM-1:30PM

BB40 Sync Framework: Enterprise Data in the Cloud and on Devices 408A 10/28/2008 5:15PM-6:30PM

TL30 Microsoft Sync Framework Advances 515B 10/27/2008 1:45PM-3:00PM

BB16 SQL Server 2008: Beyond Relational 406A 10/28/2008 1:45PM-3:00PM

BB26 SQL Server 2008: Business Intelligence and Data Visualization 515A 10/28/2008 1:45PM-3:00PM

BB24 SQL Server 2008: Deep Dive into Spatial Data 404A 10/29/2008 3:00PM-4:15PM

BB07 SQL Server 2008: Developing Large Scale Web Applications and Services 411 10/28/2008 1:45PM-3:00PM

BB37 SQL Server 2008: Developing Secure Applications 515A 10/29/2008 12:00PM-12:45PM

BB25 SQL Server 2008: New and Future T-SQL Programmability 515A 10/29/2008 1:15PM-2:30PM

PC40 SQL Server Compact: Embedding in Desktop and Device Applications 402A 10/29/2008 3:00PM-4:15PM

TL42 Microsoft SQL Server 2008: Powering MSDN 411 10/29/2008 12:00PM-12:45PM

TL14 Project "Velocity": A First Look 403AB 10/28/2008 1:45PM-3:00PM

TL56 Project "Velocity": Under the Hood 403AB 10/28/2008 3:30PM-4:45PM

PC44 Windows 7: Programming Sync Providers That Work Great with Windows 408B 10/28/2008 12:45PM-1:30PM
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista 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.

Potrebbero piacerti anche