Top Banner
RICK KRUEGER DAVE VALENTINE @dataogre dataogre.com linkedin.com/in/premie rapps @ingeniousSQL ingeniousSQL.com linkedin.com/in/ingeni oussql RULES OF ENGAGEMENT: NOSQL IS SQL SERVER’S ALLY
64

RICK KRUEGER

Feb 26, 2016

Download

Documents

questa

RULES OF ENGAGEMENT: NOSQL IS SQL SERVER’S ALLY. RICK KRUEGER. DAVE VALENTINE. @ dataogre dataogre.com linkedin.com/in/ premierapps. @ ingeniousSQL ingeniousSQL.com linkedin.com/in/ ingenioussql. Why Rules of Engagement?. - PowerPoint PPT Presentation
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: RICK KRUEGER

RICK KRUEGER DAVE VALENTINE @dataogre dataogre.com

linkedin.com/in/premierapps

@ingeniousSQL ingeniousSQL.com

linkedin.com/in/ingenioussql

RULES OF ENGAGEMENT:NOSQL IS SQL SERVER’S ALLY

Page 2: RICK KRUEGER

Why Rules of Engagement?

“Directives issued by competent military authority that delineate the circumstances and limitations under which United States forces will initiate and/or continue combat engagement with other forces encountered” - http://ra.defense.gov (JP-104)

Page 3: RICK KRUEGER

Why Rules of Engagement?

“Directives issued by competent military authority that delineate the circumstances and limitations under which United States forces will initiate and/or continue combat engagement with other forces encountered” - http://ra.defense.gov (JP-104)

Page 4: RICK KRUEGER

Why Rules of Engagement?

“Directives issued by competent military authority that Delineate the circumstances and limitations under which United States forces will initiate and/or continue combat engagement with other forces encountered” - http://ra.defense.gov (JP-104)

Page 5: RICK KRUEGER

Why Rules of Engagement?

“Directives issued by competent military authority that delineate the circumstances and limitations under which United States forces will

initiate and/or continue Combat engagement with other forces encountered” - http://ra.defense.gov (JP-104)

Page 6: RICK KRUEGER

AGENDA

NoSQL Family Key Value Column Store Document Databases Graph Databases

Polyglot Persistence Eventual Consistency Wrap Up Questions & Answers

Page 7: RICK KRUEGER

Key Value

SimpleMy Car123

C-4140-9564-5B282124

U.S. Air Force photo

Page 8: RICK KRUEGER

Key Value

Simple

Fast

My Car123

C-4140-9564-5B282124

U.S. Air Force photo

Page 9: RICK KRUEGER

Key Value

Simple

FastScalable

My Car123

C-4140-9564-5B282124

U.S. Air Force photo

Page 10: RICK KRUEGER

Key Value

Simple

FastScalableCheap

My Car123

C-4140-9564-5B282124

U.S. Air Force photo

Page 11: RICK KRUEGER

Key Value

Simple

FastScalableCheapKey Structure

My Car123

C-4140-9564-5B282124

U.S. Air Force photo

Page 12: RICK KRUEGER

We have to wait how long?

Page 13: RICK KRUEGER

Key ValueCouchbase

Adidas, ADP, BMWLinux, Windows, OS Xhttp://www.couchbase.com/

RiakYammer, Best Buy, GithubLinux, OS Xhttp://basho.com/riak/

RedisTwitter, Craigslist, flickrLinux, OS Xhttp://redis.io/

Page 14: RICK KRUEGER

Key Value – When to use

Keys value pairsWeb ComponentsDevice Check-in

Page 15: RICK KRUEGER

Key Value: The Need For Speed BEFORE

100K

AFTER

100K

Cach

e

Page 16: RICK KRUEGER

Column Stores

DoD photo by Petty Officer 1st Class Benjamin D. Olvey, U.S. Navy. (Released)

Page 17: RICK KRUEGER

Column Stores

123455 Car: 626 Year: 2008 Name: Jen Insurance: St Farm

ID Name Insurance Car Year Warrant

y123455 Jen St Farm 626 2008 NULL12356 Bob

12357 John Geico Speed 3 2013 Yes

123456 Name: Bob

123457 Car: Speed 3 Year: 2013 Name: John Insurance: Geico 10

11

12

Type: Oil

Type: Tires

Type: Wipers

Warranty: Yes

ID Type CarID10 Oil 1235711 Tires 12357

12 Wipers 12357

Person_Details Car_Details

Page 18: RICK KRUEGER

Column Stores

ScalableSimple is FastColumn AggregationComplex = Map ReduceComplex can be Slow

DoD photo by Petty Officer 1st Class Benjamin D. Olvey, U.S. Navy. (Released)

Page 19: RICK KRUEGER

Column StoresScalableSimple is FastColumn AggregationComplex = Map ReduceComplex can be Slow

DoD photo by Petty Officer 1st Class Benjamin D. Olvey, U.S. Navy. (Released)

Page 20: RICK KRUEGER

Column StoresScalableSimple is FastColumn AggregationComplex = Map ReduceComplex can be Slow

DoD photo by Petty Officer 1st Class Benjamin D. Olvey, U.S. Navy. (Released)

Page 21: RICK KRUEGER

Column StoresScalableSimple is FastColumn AggregationComplex = Map ReduceComplex can be Slow

DoD photo by Petty Officer 1st Class Benjamin D. Olvey, U.S. Navy. (Released)

Page 22: RICK KRUEGER

Column StoresScalableSimple is FastColumn AggregationComplex = Map ReduceComplex can be Slow

DoD photo by Petty Officer 1st Class Benjamin D. Olvey, U.S. Navy. (Released)

Page 23: RICK KRUEGER

Column StoresHBase

eBay, BlackBerry, ExpediaLinux, OS X, Windows **http://hbase.apache.org/

CassandraFacebook, Shazam, TwitterLinux, OS X, Windowshttp://cassandra.apache.org/

** Additional software is required

HD

Insigh

t

Page 24: RICK KRUEGER

Column Stores: Do I need it…

Unstable Schema

Nullable Columns

Collections

http://www.youtube.com/watch?v=7hfpQMu5xJ0

Page 25: RICK KRUEGER

Document Databases

"That's so crazy that it just might work!"

Page 26: RICK KRUEGER

Document Databases: Planning

http://www.blueangels.navy.mil/

Page 27: RICK KRUEGER

Document Databases: Schemaless?

Page 28: RICK KRUEGER

Document Databases: Not Relational

Trims Table411 1790 Base 118412 1790 John Cooper Works 208413 1790 S 172414 1791 Base 121

Models Table1790 Clubman1791 Countryman1792 Coupe1793 Roadster

Page 29: RICK KRUEGER

Document Databases: NormalizedJSON:

JavaScript Object Notation

Page 30: RICK KRUEGER

Document Databases: Denormalized

Page 31: RICK KRUEGER

Document Databases: Natural

Page 32: RICK KRUEGER

Document Databases: OptionsmongoDB

Craigslist, Foursquare, Shutterfly, IntuitWindows, Linux, and OS Xhttp://www.mongodb.org/

CouchDB (CouchBase)HootSuite, VimeoWindows, Linux, and OS Xhttp://couchdb.apache.org/

RavenDBMSNBC.COM, JetBrainsWindows and Linuxhttp://ravendb.net/

Page 33: RICK KRUEGER

Document Databases

RavenDB Management Studio

Page 34: RICK KRUEGER

Document Databases

CouchDB Futon

Page 35: RICK KRUEGER

You Might Need A Document Database…if your application is document based (eg Content Management, Blogging, User Data Management), or the data isn’t tabular or structured…if you want to archive data, and do not want to deal with schema changes in the archived table…if you are looking for an easier upgrade path or have constant schema churn…if you find yourself using SQL antipatterns, like EAV (Entity-attribute-value)…if programmer friendliness is a big concern

Page 36: RICK KRUEGER

Graph DatabasesRelationships

Nodes PropertiesEdges

RecordsDataPK / FK

2: (Make: Mini, Model: Clubman)

1: (Name: Rick, DOB:20120505)

OWNS:(VIN: 12BA126)

DoD photo by Staff Sgt. Samuel BendetU.S. Air Force (Released)

Page 37: RICK KRUEGER

Graph Databases

Page 38: RICK KRUEGER

Graph Databases

1 | Rick

2 | Dave

3 | Mini

4 | Yugo

Owns

Wants

Wants

Owns

6 | 626

Want

s

5 | Glen

Owns

Wants

http://jalopnik.com/365474/how-about-a-yugo-for-the-24-hours-of-lemons

7 | Brandon

9 | Bob

11 | Nick

8 | S4

13 | A6

10 | M4

12 | Neon

Owns

OwnsWants

Owns

Wants

Owns

Wan

ts

Page 39: RICK KRUEGER

Graph Databases

https://www.facebook.com/about/graphsearch

Page 40: RICK KRUEGER

Graph DatabasesNeo4j

Adobe, Cisco, T-MobileLinux, OS X, Windowshttp://www.neo4j.org/

AllegroGraphNASA, Kodak, PfizerLinux, OS X, Windowshttp://www.franz.com/agraph/allegrograph/

InfiniteGraphCIA, DODLinux, OS X, Windowshttp://www.objectivity.com/infinitegraph

Page 41: RICK KRUEGER

Graph Databases

Page 42: RICK KRUEGER

Graph Databases

Page 43: RICK KRUEGER

Graph Databases

Page 44: RICK KRUEGER

Graph Databases – When to use…

Network

Relationships

Geo

Page 45: RICK KRUEGER

Polyglot Persistence"This is space! Course, we’re just in the beginning part of space, we-we haven’t even got to *outer* space yet!“

– Armageddon (1998)

Page 46: RICK KRUEGER

Polyglot Persistence: Write-Only

Page 47: RICK KRUEGER

Polyglot Persistence: Write Only Graph Database? Key Value? Column Store? Document Database?

Page 48: RICK KRUEGER

Polyglot Persistence: Schema Upgrade

Page 49: RICK KRUEGER

Polyglot Persistence: Archiving

Page 50: RICK KRUEGER

Polyglot Persistence: Cache

OLTP Warehouse

Other Data

Nightly

Nightly

Page 51: RICK KRUEGER

Polyglot Persistence: Cache

Warehouse

Other Data

Version 1

Version 2

Version 3

Page 52: RICK KRUEGER

Polyglot Persistence: 1000 Words

Page 53: RICK KRUEGER

Consistency

Page 54: RICK KRUEGER

Consistency: We want it ALL Speed Availability Scale

Consistency Latency

Page 55: RICK KRUEGER

Consistency: Definitions

N – the number of Nodes (or replicas) that store the dataW – the minimum number of nodes that must acknowledge the Write before considered completeR – the minimum number of Read nodes (or replicas) queried for a read operation

Page 56: RICK KRUEGER

Consistency: Distributed

Replica 1

Replica 2

Replica 3

Page 57: RICK KRUEGER

Consistency: Strong

W+R > N == Strong Consistency

N = 2W = 2 R = 1

Page 58: RICK KRUEGER

Consistency: Strong

W+R > N == Strong Consistency

N = 2W = 1 R = 2

Page 59: RICK KRUEGER

Consistency: Weak

N = 2W = 1 R = 1

W+R <= N == Weak Consistency

Page 60: RICK KRUEGER

Consistency LatencyStrong Weak Low High

Synchronous ReplicationHigh Safety MirroringSynchronous AlwaysOn Availability GroupAsynchronous ReplicationHigh Performance MirroringAsynchronous AlwaysOn Availability Group

Active Secondaries: Readable Secondary Replicas“In many circumstances, data latency between a primary database and the corresponding secondary database is only a few seconds.” -http://msdn.microsoft.com/en-us/library/ff878253.aspx

Consistency: SQL Scale Out

Page 61: RICK KRUEGER

Consistency: Cost

Google search result count = 30 resulted in 20% loss

Amazon, 100ms delays perceptible to users

Speed matters!

Page 62: RICK KRUEGER

Rules of Engagement

Key Value

Column Store

Document

Database

Graph

RDBMS

90% of

Data

Data Size / Scalability

Data

Co

mpl

exity

Page 63: RICK KRUEGER

Remember

Pick the store that matches the shape of your data

Don’t use SQL Server to build Rube Goldberg Machines

If anyone thinks that NoSQL means no planning, they couldn’t be more wrong

Stay informed: NoSQLWeekly.com

Page 64: RICK KRUEGER

Questions?

RICK KRUEGER DAVE VALENTINE @dataogre dataogre.com

linkedin.com/in/premierapps

@ingeniousSQL

ingeniousSQL.com

linkedin.com/in/ingenioussql