41

Web Scale with NoSQL

Embed Size (px)

DESCRIPTION

Introduction to NoSQL, RDBMS Scalability, Why NoSQL, Categories of NoSQL, SQL vs NoSQL

Citation preview

Page 1: Web Scale with NoSQL
Page 2: Web Scale with NoSQL

Web Scale with NoSQLSergejus Barinovas (@sergejusb)

http://sergejus.blogas.lt

Page 3: Web Scale with NoSQL

Who Am I?

Architect at Running NoSQL servers in production

Blogger (http://sergejus.blogas.lt, @sergejusb)

Community member (http://dotnetgroup.lt)

Contact me via [email protected]

Page 4: Web Scale with NoSQL

Powered by RDBMS

Used everywhere… …even where it shouldn’t

Used for 30+ years!

Page 5: Web Scale with NoSQL

Back to 1980’s…

Page 6: Web Scale with NoSQL

Data boom

Page 7: Web Scale with NoSQL

in numbers

600 000 000 users

30 000 servers

20+ TB raw data per day

>20 PB stored data

Page 8: Web Scale with NoSQL

You really think they use RDBMS?

Page 9: Web Scale with NoSQL

RDBMS Scaling Example

Page 10: Web Scale with NoSQL

Simple usage

Customers

Reads / Writesmaster

Page 11: Web Scale with NoSQL

Scale reads

Customers

Writes master

slave slave

Reads

Page 12: Web Scale with NoSQL

Scale writes

Customers [A-M]Reads / Writes [A-M]

master

masterCustomers [N-Z]Reads / Writes [N-Z]

Page 13: Web Scale with NoSQL

Reads [A-M

]

Scale reads / writes

Customers [A-M]

Writes [A-M]

master

slave slave

Reads [A-M]

masterCustomers [N-Z]

slave slave

Writes [N-Z]

Page 14: Web Scale with NoSQL

Pray your system won’t fail

Page 15: Web Scale with NoSQL

Enter the NoSQL

Page 16: Web Scale with NoSQL

Why NoSQL

Limited SQL scalability Sharding and vertical partitioning

Limited SQL availability Master / slave configuration

Limited SQL speed of read operations Multiple read replicas

SQL limitations for huge amount of data Key / value / type columns

Page 17: Web Scale with NoSQL

NoSQL history

2009, Eric Evans, no:sql(est)

NoSQL – open source distributed databases, not relational SQL databases

NoSQL – not only SQL

NoSQL → Big Data

Page 18: Web Scale with NoSQL

NoSQL characteristics (1/2)

Scalability The ability to horizontally scale simple-

operation throughput over many servers

BASE A “weaker” concurrency model than the ACID

transactions in most SQL systems

Page 19: Web Scale with NoSQL

NoSQL characteristics (2/2)

Distributed Efficient use of distributed indexes and RAM

for data storage

Schema-less The ability to dynamically define new

attributes or data schema

Page 20: Web Scale with NoSQL

CAP theorem

2000, Eric Brewer It is impossible for a distributed computer

system to simultaneously provide all three of the following guarantees:

Consistency Availability Partition tolerance

Page 21: Web Scale with NoSQL
Page 22: Web Scale with NoSQL

NoSQL Databases

Page 23: Web Scale with NoSQL

NoSQL categories

Key / value store

Document database

Graph database

Columnar database

Page 24: Web Scale with NoSQL

Key / value store

<key, value> or Tuple<key, v1,. ., vn> Simple operations

Get Put Delete

Byte[] Byte[]

Key Value

Page 25: Web Scale with NoSQL

Key / value store

Key Value

“current_date” 2023-04-08

“sergejusb” Binary Object

“sergejusb” JSON Object

Page 26: Web Scale with NoSQL

Key / value stores

Redis (+)messaging (-)no shards

Voldermort

Membase (+)memcache interface

Riak

Page 27: Web Scale with NoSQL

Document database

Document == complex object XML YAML JSON / BSON

Support for secondary indexes Schema can be defined at runtime Optional support for simple querying

using Map / Reduce

Page 28: Web Scale with NoSQL

Document databases

MongoDB (+)shards

CouchDB (+)master / master replication

Page 29: Web Scale with NoSQL

Graph database

Graph == network Basic constructs

Node Edge Properties

sergejus

sergejus.blogas.lt

tdagys

auth

ors reads

knows

knows

Page 30: Web Scale with NoSQL

Graph databases

Neo4j (-)paid version required for scaling

FlockDB (+)fast (-)limited functionality

Page 31: Web Scale with NoSQL

Columnar database

For HUGE amount of data

Columns are added at a runtime

Great scalability Horizontal Vertical

Page 32: Web Scale with NoSQL

Columnar database

Unusual data model Key Space → Database Column Family → Table Columns and Super Columns Super Column → array of Columns Column → Tuple<Key, Value, Timestamp, TTL>

Page 35: Web Scale with NoSQL

Columnar database

Cassandra (+)easy scalable

HBase (+)consistent (+)part of Hadoop

Hypertable

Page 36: Web Scale with NoSQL

NoSQL is Cool! But…

Page 37: Web Scale with NoSQL
Page 38: Web Scale with NoSQL

NoSQL limitations

ORDER BY ? Natural key order

GROUP BY ? Map / Reduce*

JOIN ? Multiple Map / Reduce*

SELECT * ? Multi-machine Map / Reduce*

*if possible

Page 39: Web Scale with NoSQL

NoSQL Limitations

Maturity

Tooling

Specificity

Page 40: Web Scale with NoSQL

SQL vs. NoSQL

Choose the right tool for the task

You can use BOTH

Page 41: Web Scale with NoSQL

Thank you!

Sergejus Barinovas (@sergejusb)

[email protected]

http://sergejus.blogas.lt