Is NoSQL the Future of Data Storage?

38
Is NoSQL the Future of Data Storage? By Gary Short Developer Express

description

Is NoSQL the Future of Data Storage?. By Gary Short Developer Express. Introduction. Gary Short Technical Evangelist for Developer Express C# MVP [email protected] www.garyshort.org @ garyshort . Where Does NoSQL Originate?. 1998 OS relational database - PowerPoint PPT Presentation

Transcript of Is NoSQL the Future of Data Storage?

Page 1: Is  NoSQL  the Future of Data Storage?

Is NoSQL the Future of Data Storage?

By Gary ShortDeveloper Express

Page 2: Is  NoSQL  the Future of Data Storage?

Introduction

• Gary Short• Technical Evangelist for Developer Express• C# MVP• [email protected]• www.garyshort.org• @garyshort.

Page 3: Is  NoSQL  the Future of Data Storage?
Page 4: Is  NoSQL  the Future of Data Storage?

Where Does NoSQL Originate?

• 1998– OS relational database• Didn’t expose an SQL interface

• Created by Carlo Strozzi– Said the NoSQL movement• “departs from the relational model altogether...”• “...should have been called ‘NoREL”.

Page 5: Is  NoSQL  the Future of Data Storage?

More Recently...

• Eric Evans reintroduced the term in 2009– Johan Oskarsson (last.fm)• Event to discuss OS distributed databases

• This labels growing number datastores– Open source– Non-relational– Distributed– (often) don’t guarantee ACID.

Page 6: Is  NoSQL  the Future of Data Storage?

Atlanta 2009

• No:sql(east) conference• Billed as “conference of no-rel datastores”• Worst tag line ever– SELECT fun, profit FROM real_world WHERE rel=false.

Page 7: Is  NoSQL  the Future of Data Storage?

Not Ant-RDBMS

Page 8: Is  NoSQL  the Future of Data Storage?

Key Attributes of NoSQL Databases

• Don’t require fixed table schemas• Non-relational• (Usually) avoid join operations• Scale horizontally– Adding more nodes to a storage system.

Page 9: Is  NoSQL  the Future of Data Storage?

What Does the Taxonomy Look Like?

Page 10: Is  NoSQL  the Future of Data Storage?

Document Store

• Apache Jackrabbit• CouchDB• MongoDB• SimpleDB• XML Databases– MarkLogic Server– eXist.

Page 11: Is  NoSQL  the Future of Data Storage?

Document What?

• Okay think of a web page...– Relational model requires column/tag– Lots of empty columns– Wasted space

• Document model just stores the pages as is– Saves on space– Very flexible.

Page 12: Is  NoSQL  the Future of Data Storage?

Graph Storage

• AllegroGraph• Core Data• Neo4j• DEX• FlockDB.

Page 13: Is  NoSQL  the Future of Data Storage?

Which Means?

• Graph consists of– Node (‘stations’ of the graph)– Edges (lines between them)

• FlockDB– Created by the Twitter folks– Nodes = Users– Edges = Nature of relationship between nodes.

Page 14: Is  NoSQL  the Future of Data Storage?

Key/Value Stores

• On disk• Cache in Ram• Eventually Consistent

– Weak Definition• “If no updates occur for a period, eventually all updates will

propagate through the system and all replicas will be consistent”– Strong Definition

• “for a given update and a given replica eventually either the update reaches the replica or the replica retires”

• Ordered– Distributed Hash Table allows lexicographical processing.

Page 15: Is  NoSQL  the Future of Data Storage?

Object Databases

• Db4o• GemStone/S• InterSystems Caché• Objectivity/DB• ZODB.

Page 16: Is  NoSQL  the Future of Data Storage?

Okay got it, Now Let’s Compare Some Real World Scenarios

Page 17: Is  NoSQL  the Future of Data Storage?

You Need Constant Consistency

• You’re dealing with financial transactions• You’re dealing with medical records• You’re dealing with bonded goods• Best you use a RDMBS .

Page 18: Is  NoSQL  the Future of Data Storage?

You Need Horizontal Scalability

• You’re working across defined timezones• You’re Aggregating large quantities of data• Maintaining a chat server (Facebook chat)• Use NoSQL.

Page 19: Is  NoSQL  the Future of Data Storage?

Up in the Clouds Baby

• If you are using Azure or AWS– Compare costs of Azure Storage or SimpleDB to

SQL Azure or Elastic RDBMS• Could be cheaper for your scenario.

Page 20: Is  NoSQL  the Future of Data Storage?

It’s all About the iPhone!

Page 21: Is  NoSQL  the Future of Data Storage?

Frequently Written Rarely Read

• Think web counters and the like• Every time a user comes to a page = ctr++• But it’s only read when the report is run• Use NoSQL (key-value storage).

Page 22: Is  NoSQL  the Future of Data Storage?

I Got Big Data!

• Think weather stats• Satellite Images• Maps• Use NoSQL ( Something like Hadoop).

Page 23: Is  NoSQL  the Future of Data Storage?

Binary Baby!

• If you are YouTube• Flickr• Twitpic• Spotify• NoSQL (Amazon S3).

Page 24: Is  NoSQL  the Future of Data Storage?

Here Today Gone Tomorrow

• Transient data like..– Web Sessions– Locks– Short Term Stats• Shopping cart contents

• Use NoSQL (Memcache).

Page 25: Is  NoSQL  the Future of Data Storage?

Data Replication

• Same data in two or more locations– Music Library• Web browser• iPone App

• NoSQL (CouchDB).

Page 26: Is  NoSQL  the Future of Data Storage?

Hit me Baby One More Time!

• High Availability– High number of important transactions• Online gambling• Pay Per view

– Ahem!• Online Auction

• NoSQL (Cassandra – automatic clustering).

Page 27: Is  NoSQL  the Future of Data Storage?

Give me a Real World Example

• Twitter– The challenges• Needs to store many graphs

– Who you are following– Who’s following you– Who you receive phone notifications from etc

• To deliver a tweet requires rapid paging of followers• Heavy write load as followers are added and removed• Set arithmetic for @mentions (intersection of users).

Page 28: Is  NoSQL  the Future of Data Storage?

What Did They Try?

• Relational Databases• Key-Value storage of denormalized lists• Did it work?– Nope!• Either good at

– Handling the write load– Or paging large amounts of data– But not both .

Page 29: Is  NoSQL  the Future of Data Storage?

What Did They Need?

• Simplest possible thing that would work• Allow for horizontal partitioning• Allow write operations to– Arrive out of order– Or be processed more than once

• Failures should result in redundant work– Not lost work!

Page 30: Is  NoSQL  the Future of Data Storage?

The Result was FlockDB

• Stores graph data• Not optimised for graph traversal operations• Optimised for large adjacency lists– List of all edges in a graph• Key is the edge value a set of the node end points

• Optimised for fast read and write• Optimised for page-able set arithmetic.

Page 31: Is  NoSQL  the Future of Data Storage?

How Does it Work?

• Stores graphs as sets of edges between nodes• Data is partitioned by node– All queries can be answered by a single partition

• Write operations are idempotent– Can be applied multiple times without changing the

result• And commutative– Changing the order of operands doesn’t change the

result.

Page 32: Is  NoSQL  the Future of Data Storage?

Commutative Writes Help Bring up Partitions

• Partition can receive write traffic immediately• Receive dump of data in the background• Live for read as soon as the dump is complete.

Page 33: Is  NoSQL  the Future of Data Storage?

Performance?

• Currently store 13 billion edges• 20K writes / second• 100K reads / second.

Page 34: Is  NoSQL  the Future of Data Storage?

Lessons Learned?

• Use aggressive timeouts– Cut a client loose after timeout expired– Let it try again on another app server

• Use same code path for error and normal ops– Error requests are periodically retried

• Instrument.

Page 35: Is  NoSQL  the Future of Data Storage?

Punchline?

• Under all the bells and whistles...– Its MySQL .

Page 36: Is  NoSQL  the Future of Data Storage?

So is this the Future?

• Yes!• And No!

Page 37: Is  NoSQL  the Future of Data Storage?

Questions?

• Contact me– [email protected]– @garyshort

Page 38: Is  NoSQL  the Future of Data Storage?

Coming up…P/X001Understanding and Preventing SQL Injection AttacksKevin KlineP/L001SSIS FieldnotesDarren GreenP/L002The (Geospatial) Shapes of Things to ComeSimon MunroP/L005End to End Master Data Management with SQL Server Master Data ServicesJeremy KashelP/T007Understanding Microsoft Certification in SQL ServerChris Testa-O'Neill

#SQLBITS