Windows Azure: Is the Relational Database Dead?
description
Transcript of Windows Azure: Is the Relational Database Dead?
![Page 1: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/1.jpg)
Windows Azure: Is the Relational Database Dead?Benjamin Dayhttp://benday.com
![Page 2: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/2.jpg)
Who am I?
Owner, Benjamin Day Consulting, Inc.– Email: [email protected]– Web: http://www.benday.com– Blog: http://blog.benday.com
Trainer, Consultant– Visual Studio Team System, Team Foundation Server
Microsoft MVP for VSTS Microsoft VSTS/TFS Customer Advisory Council Microsoft Cloud Services Advisory Group Leader of Beantown.NET INETA User Group
![Page 3: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/3.jpg)
Agenda Big thanks to
– Steve Marx @ Microsoft– Manuvir Das @ Microsoft– David Aiken @ Microsoft
Is the relational database dead? What is Windows Azure? Develop Your Application Deploy To Staging and Production Some Stuff To Think About
![Page 4: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/4.jpg)
Is the relational database dead?
It depends. (Probably not.) Cloud will change everything. Relational database “best practices” are
probably dead…
…at least in the cloud.
![Page 5: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/5.jpg)
AZURE
![Page 6: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/6.jpg)
The Azure Platform
![Page 7: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/7.jpg)
The Azure Platform
![Page 8: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/8.jpg)
The “cloud” in Cloud Services?
Think data-center somewhere on the internet
Allows you to run your app Allows you to read and write data
![Page 9: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/9.jpg)
Ok. So what’s Windows Azure?
Microsoft’s “cloud”– Every cloud has an Azure lining?
Custom version of Windows– Optimized for utility computing applications– Always runs virtualized on the Azure Fabric
Azure Fabric– Runs instances of your apps– Handles “everything”
Azure Storage Azure SDK for Visual Studio
![Page 10: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/10.jpg)
Why Azure? “I’ve got my awesome data-center so…” No more worrying about…
– Buying, configuring, maintaining hardware– Buying, configuring, maintaining the operating
system – Network infrastructure• Routers, Switches, Load Balancers– Your data-center’s power and internet
connections– Failovers
Worry less about…– App deployment– Capacity planning
Focus on writing your app
![Page 11: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/11.jpg)
Simple Scale Out
Changes in traffic
Need more servers?
Need fewer servers?
![Page 12: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/12.jpg)
I want everything…
…and it should be easy. Azure let’s you worry about writing your
app Don’t have to learn a whole bunch of
new stuff Leverage your existing dev skills
![Page 13: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/13.jpg)
Azure: The Developer View
Write it in Visual Studio– New project types– Debug your code
.NET, ASP.NET, WCF, IIS7, LINQ Azure Storage
– Database in the cloud– (with a few caveats)
Desktop development versions of– Azure Fabric– Azure Storage
![Page 14: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/14.jpg)
Demo 1: Hello, World
![Page 15: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/15.jpg)
Hello, World: Discuss.
Doesn’t look like much but…– that’s “internet scale”-able– Highly available
Mostly stuff you already know
![Page 16: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/16.jpg)
Debugging In The Cloud
We can debug a service in Visual Studio How do you debug a service that has
been deployed?– Answer: you don’t
Logging is the answer RoleManager.WriteToLog(eventLogName
, message)– Event log name values: Error, Information,
Warning, Debug, Critical
![Page 17: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/17.jpg)
Demo 1.1: Hello World + Logging
![Page 18: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/18.jpg)
AZURE STORAGE
![Page 19: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/19.jpg)
Azure Storage
Simple database in the cloud– Tables (aka. “structured storage”)– Blobs– Queues
You don’t worry about replication Scales like nobody’s business Development version
– DevelopmentStorage.exe– Uses SQL Server Express
![Page 20: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/20.jpg)
Table Storage Every row has RowKey & Partition Key RowKey = primary key PartitionKey
– Helps you tell Azure how to scale your data– You have to think about how you’ll be querying– By State? By Hour? Other?
RowKey PartitionKey FirstName LastName1 MA Ben Day2 MA John Malkovich3 WA Bill Gates4 CA Steve Jobs
![Page 21: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/21.jpg)
PartitionKey Your partitions could be on different
servers Best practice: If you know your
PartitionKey, add it to the WHERE clause No PartitionKey in the WHERE insane
table scans Recommendation: More partitions is
(probably) better
Think hard about your partition key in the beginning– Else, roll your own re-partitioning
![Page 22: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/22.jpg)
Column Data Types
Partition key and Row key– String (up to 64KB)
Other properties– String (up to 64KB)– Binary (up to 64KB)– Bool– DateTime – GUID– Int– Int64– Double
![Page 23: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/23.jpg)
Demo 2: Azure Table Storage
![Page 24: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/24.jpg)
RELATIONAL VS CLOUD
![Page 25: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/25.jpg)
What is “relational” Tables, Rows, & Columns
– All rows in the table have the same column structure
– You design the database BEFORE you add the data
Relationships between the tables Constraints on the columns Normalization eliminates duplicate
data– Data “nuggets” stored in one place only– Makes it clear what the definitive version
is
![Page 26: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/26.jpg)
Relational in your app Data is organized for the sake of the
data rather than the sake of the app– App is temporary but Schema is forever.– Represents itself as normalization and
relationships between the tables Scales nicely on a single node but
going to a cluster, it gets ugly
![Page 27: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/27.jpg)
Relational DB Engine Does A Lot
Non-trivial SELECT p.FirstName, p.LastName,
ph.PhoneNumberFROMPerson pLEFT JOINPhone phONp.Id = ph.PersonIdWHEREp.LastName LIKE 'D%'
![Page 28: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/28.jpg)
Performance Issues in Relational Avoiding duplication can cause
performance issues De-normalizing If you de-normalize and duplicate
some data:– you can lower the number of required to
build an "object"– You can lower the amount of "heavy lifting"
that the db has to do to retrieve your data That JOIN isn't easy Indexes help but it still is a lot of work
![Page 29: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/29.jpg)
Why Stored Procedures? (1 of 2)
Abstraction between the app & data Externalize the queries
– Remove them from the code– Makes the queries live with the data
more "database me me me!"
![Page 30: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/30.jpg)
Why Stored Procedures? (2 of 2)
Security– lock down direct access to the tables– Users get rights to specific procs
Performance– Less compelling: cached execution plan• Largely irrelevant after SQL Server 7– More compelling: the query logic is near
the data
![Page 31: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/31.jpg)
Stored Procedures In The Cloud
Azure can distribute physical location of data by partition key – Is the stored proc near the data anymore?
(Well, that pretty much wraps it up for stored procedures.)
![Page 32: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/32.jpg)
What you won’t get in Azure Storage
Stored Procedures Views Triggers Foreign Keys Database enforced referential integrity User defined indexes
– (Maybe later.)
![Page 33: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/33.jpg)
While I’ve “dissed” relational…
I’m not saying “skip best practices.” Don’t put everything in the same table You’ll still have relationships between
tables– …the relationships just won’t be enforced by
the DB
![Page 34: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/34.jpg)
THE VERDICT?
![Page 35: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/35.jpg)
WHAT DO YOU THINK?
![Page 36: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/36.jpg)
OK. MOVING ON.
![Page 37: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/37.jpg)
MORE THAN JUST ASPX
![Page 38: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/38.jpg)
Utility Compute without a UI
Azure uses the concept of “Roles” Hello, World used a “Web Role” The other role is a “Worker Role”
– Think windows service in the cloud
![Page 39: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/39.jpg)
Web & Worker
![Page 40: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/40.jpg)
Demo 3: Worker Role and a Queue
In a web role, create an ASP.NET page– Creates a queue– Writes to a queue– Gets queue depth
Worker Role– Reads the queue– “Processes” the message
![Page 41: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/41.jpg)
DEPLOYMENT
![Page 42: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/42.jpg)
Demo 4: Deploy To The Cloud
Change the storage config to use production servers
![Page 43: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/43.jpg)
MISCELLANEOUS
![Page 44: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/44.jpg)
Things to think about
No foreign keys No triggers No stored procedures In Table storage, strings can only be 64k
– You’ll need to use a mix of Blob and Tables Think hard about what config values you
put in web.config/app.config vs ServiceConfiguration.cscfg
![Page 45: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/45.jpg)
The Big Questions
When?– Sometime in 2009
An actual Service Level Agreement (SLA)
More data-centers– Now in US only– Global at go-live
What will it cost?– It will depend on what you use
![Page 46: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/46.jpg)
More resources
My Blog– http://blog.benday.com– Sample code– More Azure content to come…
Steve Marx’s blog– http://blog.smarx.com/ – Evangelist for the Azure team
Azure.com
![Page 47: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/47.jpg)
Final questions?
![Page 48: Windows Azure: Is the Relational Database Dead?](https://reader035.fdocuments.us/reader035/viewer/2022062520/56815e34550346895dcc94c2/html5/thumbnails/48.jpg)
Who am I?
Owner, Benjamin Day Consulting, Inc.– Email: [email protected]– Web: http://www.benday.com– Blog: http://blog.benday.com
Trainer, Consultant– Visual Studio Team System, Team Foundation Server
Microsoft MVP for VSTS Microsoft VSTS/TFS Customer Advisory Council Microsoft Cloud Services Advisory Group Leader of Beantown.NET INETA User Group