2015/07/21 .NET Meetup

16
Demystifying NoSQL Jim Borden @borrrden Software Engineer, Couchbase

Transcript of 2015/07/21 .NET Meetup

Page 1: 2015/07/21 .NET Meetup

Demystifying NoSQLJim Borden @borrrden

Software Engineer, Couchbase

Page 2: 2015/07/21 .NET Meetup

About Me• Lead .NET Mobile Engineer @ Couchbase since

2015/01

• Based in Tokyo

• Former mobile app developer (iOS / Android /

WinRT)

• Using .NET since 2007

Page 3: 2015/07/21 .NET Meetup

What is NoSQL?•An unfortunate misnomer

•Not a rejection of SQL

•An out of control twitter hashtag

Page 4: 2015/07/21 .NET Meetup

What is the goal?

Horizontal scalability

Fault tolerance

Price/Performance

Flexible data modeling

Page 5: 2015/07/21 .NET Meetup

CAP Theorem

A partition tolerant system either needs to sacrifice consistency or availability.

Page 6: 2015/07/21 .NET Meetup

WTF does it mean?

Story from http://ksat.me/a-plain-english-introduction-to-cap-theorem/

Thanks for calling Remember, Inc.

Page 7: 2015/07/21 .NET Meetup

Remember, Inc. Profile

Customers call in with things they want you to remember (WRITE)

Customers call in at a later time requesting things that they asked you to remember (READ)

Page 8: 2015/07/21 .NET Meetup

The boss answers the phones for Remember, Inc. alone.

Attempt One

Problem

• Scalability: This method only works as long as there is only one person controlling all data.

Image courtesy of Boians Cho Joo Young at FreeDigitalPhotos.net

Page 9: 2015/07/21 .NET Meetup

Attempt Two

Light bulb image courtesy of jannoon028 at FreeDigitalPhotos.net

The boss hires a worker

Problem

• Consistency issue: What if one call tells something to the boss and then the next asks for the same information from the worker?

Page 10: 2015/07/21 .NET Meetup

Attempt ThreeThe boss and worker relay info before completing calls

Problem

• Availability issue: Cannot do both things in parallel. If worker or boss call in sick, work never gets completed.

Page 11: 2015/07/21 .NET Meetup

Attempt FourIf one is sick or not available, send email update.

When they return, they write down all email notes into notebook

Problem• Partition tolerance issue: What if the email server goes down and sent emails are not received?

Email image courtesy of Stuart Miles at FreeDigitalPhotos.net

Page 12: 2015/07/21 .NET Meetup

How to organize data with no schema?

Generate indices via map functions, get statistics via reduce

Build queries on top of these indices

Comparable to moving the schema to runtime

Page 13: 2015/07/21 .NET Meetup

Let’s see it in action (Couchbase Server / N1QL)(With CB Server running) http://localhost:8091/index.html

http://query.pub.couchbase.com/tutorial

Page 14: 2015/07/21 .NET Meetup

Learn More

http://www.couchbase.com/developers

https://forums.couchbase.com/

Page 15: 2015/07/21 .NET Meetup

Learn More

http://www.meetup.com/Couchbase-Tokyo/ (English)

https://couchbasejpcommunity.doorkeeper.jp/ (日本語)

Page 16: 2015/07/21 .NET Meetup