no sql is not about sql
DESCRIPTION
No SQL is not about SQL. No SQL is a Zoo.. . Key-Value Stores. Wide Column Stores. SimpleDB. BigTable. Azure Table. Document Stores. Graph Databases. Why not Traditional RDBMs?. Offer incredibly useful guarantees and have been battleworn and tested. Referential Integrity. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/1.jpg)
![Page 2: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/2.jpg)
No SQL is not about SQL
![Page 3: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/3.jpg)
No SQL is a Zoo.. Key-Value Stores
BigTableSimpleDB
Azure Table
Wide Column Stores
Document Stores Graph Databases
![Page 4: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/4.jpg)
Why not Traditional RDBMs?Offer incredibly useful guarantees and have been battleworn and tested.
![Page 5: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/5.jpg)
Referential Integrity
![Page 6: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/6.jpg)
ACID Transactions
![Page 7: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/7.jpg)
And SQL..
SQL is a powerful expressive DSL (Domain Specific Language) that many, many people understand.
![Page 8: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/8.jpg)
So Why No SQL?
![Page 9: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/9.jpg)
Web Scale
![Page 10: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/10.jpg)
Web scale can be done in SQL
![Page 11: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/11.jpg)
How?• Vertical Part / Logical Sharding
(Instagram)• Caching (28 terabytes Facebook,
2008)• SQL + No SQL• Think about your Architect
Want to learn more? Spend time on http://highscalability.com/
![Page 12: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/12.jpg)
But a reasonable question is..
How much time should we be devoting to managing scaling problems versus adding business value to these systems?
![Page 13: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/13.jpg)
So what are we giving up?
![Page 14: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/14.jpg)
Availability
Consistency
Partitiontolerant
MongoDB
MySQLSQL Server
Oracle
RDBMsHBase (Hadoop)
Google BigTable
DynamoCouch Cassandra
Voldemort
Redis
SimpleDB
CAP
![Page 15: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/15.jpg)
FriendsWhoCook.comA social network of friends who enjoy cooking great food.
- Add my Recipes - Add my friends- Show my friends- Like / Comment on my Friend’s Recipes- Search recipes of my friends, their
friends, and so on by.
![Page 16: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/16.jpg)
![Page 17: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/17.jpg)
![Page 18: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/18.jpg)
![Page 19: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/19.jpg)
Problem 1: Store Recipes
![Page 20: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/20.jpg)
Fairly Simple Objectclass Recipe {
Image PhotoList<Comments> CommentsList<Ingredients> IngredientsList<ProfileId> LikesCategory RecipeCategory}
![Page 21: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/21.jpg)
Becomes a complex RDBM’ess
![Page 22: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/22.jpg)
Object-Relational Impedance Mismatch
![Page 23: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/23.jpg)
No SQL: Document Store• Data element is a document• Documents grouped into collections• Often store in JSON• Works great with Domain Driven
Design• Schema-less
![Page 24: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/24.jpg)
Document Store Examples• MongoDB (PC)• CouchDB (PA)• RavenDB (PA)
![Page 25: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/25.jpg)
DEMO: MongoDB
![Page 26: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/26.jpg)
Demo: CouchDB
![Page 27: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/27.jpg)
Problem 2: Model the Social Graph
![Page 28: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/28.jpg)
Friends in RDBMS
For a more sophisticated view of modeling graphs in an RDBMs:http://www.slideshare.net/quipo/rdbms-in-the-social-networks-age
![Page 29: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/29.jpg)
Get my Friends
Declare @ProfileID int
SELECT FirstDegreeProfile.ID, FirstDegreeProfile.FirstName, FirstDegreeProfile.LastName
FROM Profile AS FirstDegreeProfileJOIN Friendship ON FirstDegreeProfile.ID = Friendship.FriendIDWHERE Friendship.ProfileID = @ProfileID
![Page 30: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/30.jpg)
Friends and their friends
Declare @ProfileID int Set @ProfileID = 1
Select FirstDegreeFriendship.FriendId as MyFriendId, SecondDegreeProfile.ID as
SecondDegreeId, SecondDegreeProfile.FirstName as SecondDegreeFirstName, SecondDegreeProfile.LastName as SecondDegreeLastName
from Profile as SecondDegreeProfileJoin Friendship as SecondDegreeFriendship ON SecondDegreeProfile.ID = SecondDegreeFriendship.FriendIDjoin Friendship as FirstDegreeFriendship ON SecondDegreeFriendship.ProfileID = FirstDegreeFriendship.FriendIDWhere FirstDegreeFriendship.ProfileId = @ProfileId
/* Note: A much better solution would use a recursive CTE to compute transitive closure */
![Page 31: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/31.jpg)
Graph Databases• Optimized for graphs data• Check out Neo4J
![Page 32: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/32.jpg)
Problem 3: Schemaless / Big Data
Facebook's Network: Credit Traud & Frost, UNC-Chapel Hill
![Page 33: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/33.jpg)
How do we ask these questions?• After we changed the “like” button
icon for half of our users, did we get more or less likes from that sample?
• Of users who click on our ads, what pages did they spend the most time on?
• Which hidden patterns might make us competitive that we aren’t even aware of?Want to get far ahead of the pack? Read “The Lean Startup” by Eric Ries
![Page 34: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/34.jpg)
Is this Actionable?
![Page 35: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/35.jpg)
How about this?
![Page 36: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/36.jpg)
Wide Column“A Bigtable is a sparse, distributed, persistent multidimensional sorted map”
Source: http://jimbojw.com/wiki/index.php?title=Understanding_Hbase_and_BigTable
![Page 37: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/37.jpg)
MapReduceMap(k,v) [(k1, v1), (k2, v2), (k1, v3), (k3, v4)]Map(k, v) (list of intermediate key / value pairs)
Internal Step: Takes list of intermediate key value pairs and converts to a key / list of values.
Reduce(k, [v1, v2, v3…]) (k, n1), (k, n2)
![Page 38: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/38.jpg)
One Down Side…• We have to have smart people write
MapReduce programs and the problems need to be expressible as Map Reduce..
• General solutions are BIG money.
![Page 39: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/39.jpg)
Final thought: Big Data is BIG
= ?
![Page 40: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/40.jpg)
Things to Read• Bigtable: A Distributed Storage System for
Structured Data • Dynamo: Amazon’s Highly Available Key-value Store• MapReduce: Simplified Data Processing on Large
Clusters• The Google File System• Towards Robust Distributed Systems • http://jimbojw.com/wiki/index.php?
title=Understanding_Hbase_and_BigTable
![Page 41: No SQL is not about SQL](https://reader036.vdocuments.mx/reader036/viewer/2022081514/5681637e550346895dd45ec4/html5/thumbnails/41.jpg)
Creative Commons Acknowledgments and Thanks!
Bobwitloxrosipaw