webtech conference: nosql and web scalability

27
NoSQL and Web scalability Luca Bonmassar

Upload: luca-bonmassar

Post on 15-Jan-2015

1.416 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Webtech Conference: NoSQL and Web scalability

NoSQL and Web scalability

Luca Bonmassar

Page 2: Webtech Conference: NoSQL and Web scalability

NoSQL - introduction

• A database that does not expose an SQL interface (negative definition)

• Not a news in the computer science• Many subcategories:

– BigData– Column stores– Document databases– Key-value stores– Graph Databases

SQL

Page 3: Webtech Conference: NoSQL and Web scalability

Why NoSQL?

performance, scalability

Page 4: Webtech Conference: NoSQL and Web scalability

Does it fit in my project?

Page 5: Webtech Conference: NoSQL and Web scalability

Memcached

• A key - value storage, data is serialized• No persistent storage, data expires• A new layer between application and

database• Application must manage cache

explicitely• Performance boost

Page 6: Webtech Conference: NoSQL and Web scalability

Memcached protocol

• Human readable protocol• Set (key, val, expire)• Get (key), mget(key)• Delete (key)• Same logical interface of a Map (hash)

Page 7: Webtech Conference: NoSQL and Web scalability

Access patterns

• select * from table where p1 = property1 and p2 = property2 and p3 = property3

• key =

vs

Page 8: Webtech Conference: NoSQL and Web scalability

Access patterns

• select * from table where p1 = property1 and p2 = property2 and p3 = property3

• key = property1 property2 property3

vs

Page 9: Webtech Conference: NoSQL and Web scalability

Access patterns

• select * from table where p1 = property1 and p2 = property2 and p3 = property3

• key = property1 property2 property3:: ::

vs

Page 10: Webtech Conference: NoSQL and Web scalability

Access patterns

• select * from table where p1 = property1 and p2 = property2 and p3 = property3

• key = MD5( )property1 property2 property3:: ::

vs

Page 11: Webtech Conference: NoSQL and Web scalability

Memcached - workflow

Page 12: Webtech Conference: NoSQL and Web scalability

Memcached - workflow

Page 13: Webtech Conference: NoSQL and Web scalability

Memcached - workflow

SQL DB

Page 14: Webtech Conference: NoSQL and Web scalability

Memcached - workflow

SQL DB

Memcached

Page 15: Webtech Conference: NoSQL and Web scalability

Sharding

Page 16: Webtech Conference: NoSQL and Web scalability

Routing requests

• A-F

• G-N

• O-S

• T-Z

user Foo

user Pufuser Uwe

Page 17: Webtech Conference: NoSQL and Web scalability

NoSQL + sharding

• Split data into multiple servers• Use keys as shard entries

Page 18: Webtech Conference: NoSQL and Web scalability

NoSQL + sharding

• Split data into multiple servers• Use keys as shard entries

key: bae61f3f62f342b3c4d7f0d8dd128365

Page 19: Webtech Conference: NoSQL and Web scalability

NoSQL + sharding

• Split data into multiple servers• Use keys as shard entries

key: bae61f3f62f342b3c4d7f0d8dd128365key: bae61f3f62f342b3c4d7f0d8dd128365shard index data key

Page 20: Webtech Conference: NoSQL and Web scalability

MemcacheDB

• A Memcached server with BerkleyDB storage

• Same interface as Memcached, can be used where Memcached is already being used

• Performance are comparable to Memcached

Page 21: Webtech Conference: NoSQL and Web scalability

Memcached

MemcacheDB - workflow

SQL DB

Page 22: Webtech Conference: NoSQL and Web scalability

Memcached

MemcacheDB - workflow

Page 23: Webtech Conference: NoSQL and Web scalability

MemcachedMemcacheDB

MemcacheDB - workflow

Page 24: Webtech Conference: NoSQL and Web scalability

MemcacheDB - performance

0

22500.0

45000.0

67500.0

90000.0

read/s

write/s

MySQL MemcacheDB Memcached

key: 16 value: 100B

Page 25: Webtech Conference: NoSQL and Web scalability

Cons ?

Page 26: Webtech Conference: NoSQL and Web scalability

NoSQL references

• memcachedb.org• memcached.org• nosql.mypopescu.com• technoroy.blogspot.com/2008/07/shard-

database-design.html

Page 27: Webtech Conference: NoSQL and Web scalability

Thank you!

Any questions?

[email protected]/in/lucabonmassarwww.coderloop.com