www.softacad.bg Nikolay Tomitov - Co-CEO at SoftAcad learning - - PowerPoint PPT Presentation

softacad bg nikolay tomitov co ceo at softacad learning
SMART_READER_LITE
LIVE PREVIEW

www.softacad.bg Nikolay Tomitov - Co-CEO at SoftAcad learning - - PowerPoint PPT Presentation

www.softacad.bg Nikolay Tomitov - Co-CEO at SoftAcad learning center. Danail Alexiev Software Consultant at Axway, lector at SoftAcad learning center. www.softacad.bg 1. Document oriented databases 2. Introduction to JSON data format


slide-1
SLIDE 1

www.softacad.bg

slide-2
SLIDE 2

Nikolay Tomitov - Co-CEO at SoftAcad learning

center.

Danail Alexiev – Software Consultant at Axway,

lector at SoftAcad learning center.

www.softacad.bg

slide-3
SLIDE 3
  • 1. Document oriented databases
  • 2. Introduction to JSON data format
  • 2. Introduction to JSON data format
  • 3. Meet CouchDB
  • 4. Meet MongoDB
  • 5. CouchDB vs. MongoDB
  • 6. Demo

www.softacad.bg

slide-4
SLIDE 4

Documental Databases Relational Databases

www.softacad.bg

slide-5
SLIDE 5

www.softacad.bg

slide-6
SLIDE 6

www.softacad.bg

slide-7
SLIDE 7

1.

Introduction to CouchDB

2.

Create, Update, Remove, Query Operations

2.

Create, Update, Remove, Query Operations

3.

Views & Aggregation

4.

Concurrency

5.

Replication

6.

Pros and cons

7.

Resources

7.

Resources

www.softacad.bg

slide-8
SLIDE 8

Data is stored and returned in JSON format Data is stored and returned in JSON format Queried via HTTP RESTful API Index building language: Javascript Simple and intuitive interface

www.softacad.bg

slide-9
SLIDE 9

{ "_id": "debd7e7385464f4874dd2a38043f7825", "_rev": "3-839e43865b653a1ed73c3d21cc17c5dd", "name": "Homer", "last_names": ["Simpson", "Duff"], "phone_numbers": { "mobile": "555-666-777", “work": "666-777-555“, “work": "666-777-555“, "bar": "777-666-555“ }, "interests": ["beer", "donuts", "couches"] }

www.softacad.bg

slide-10
SLIDE 10

Key

www.softacad.bg

slide-11
SLIDE 11
  • Create:
  • HTTP PUT /db/test
  • HTTP PUT /db/test
  • Read:
  • HTTP GET /db/test
  • Update:
  • HTTP PUT /db/test
  • Delete:
  • HTTP DELETE /db/test

www.softacad.bg

slide-12
SLIDE 12

Views: the way to arrange data to answer our

questions questions

Method to build views:

Incremental MapReduce using Javascript

www.softacad.bg

slide-13
SLIDE 13

www.softacad.bg

slide-14
SLIDE 14

www.softacad.bg

slide-15
SLIDE 15

www.softacad.bg

slide-16
SLIDE 16

www.softacad.bg

slide-17
SLIDE 17

www.softacad.bg

slide-18
SLIDE 18

www.softacad.bg

slide-19
SLIDE 19

www.softacad.bg

slide-20
SLIDE 20

Views are useful for many purposes:

  • Filtering the documents in your database to find those relevant
  • Filtering the documents in your database to find those relevant

to a particular process.

  • Extracting data from your documents and presenting it in a

specific order.

  • Building efficient indexes to find documents by any value.
  • Use these indexes to represent relationships among

documents.

  • With views you can make all sorts of calculations on the data
  • With views you can make all sorts of calculations on the data

in your documents.

www.softacad.bg

slide-21
SLIDE 21

{ "_id": "debd7e7385464f4874dd2a38043f7825", "_rev": "3-839e43865b653a1ed73c3d21cc17c5dd", "name": "Homer", "last_names": ["Simpson", "Duff"], "phone_numbers": { "mobile": "555-666-777", "work": "666-777-555", "work": "666-777-555", "bar": "777-666-555" }, "interests": ["beer", "donuts", "couches"] }

www.softacad.bg

slide-22
SLIDE 22

Temenujka CouchDB Sofroniy Temenujka CouchDB Sofroniy

www.softacad.bg

slide-23
SLIDE 23

Temenujka CouchDB Sofroniy Temenujka CouchDB Sofroniy

www.softacad.bg

slide-24
SLIDE 24

Temenujka CouchDB Temenujka CouchDB

www.softacad.bg

slide-25
SLIDE 25

Temenujka CouchDB Temenujka CouchDB

www.softacad.bg

slide-26
SLIDE 26

Temenujka CouchDB Temenujka CouchDB

www.softacad.bg

slide-27
SLIDE 27

Temenujka CouchDB Temenujka CouchDB

www.softacad.bg

slide-28
SLIDE 28

CouchDB CouchDB

www.softacad.bg

slide-29
SLIDE 29

MVCC means no locking !

www.softacad.bg

slide-30
SLIDE 30

www.softacad.bg

slide-31
SLIDE 31

What is replication ? What is replication ? It could be bidirectional Offline by default Continious replication

www.softacad.bg

slide-32
SLIDE 32

POST /_replicate

{"source":"database", {"source":"database", "target":"http://example.org/database"}

By using Admin UI

www.softacad.bg

slide-33
SLIDE 33
  • Fault tolerant ( it’s written in Erlang )

Fault tolerant ( it’s written in Erlang )

  • Intuitive REST/HTTP interface
  • Easy replication
  • Deep structures and no schemas
  • Stable and scalable, so it is successful in

production

  • The only database solution optimized for
  • The only database solution optimized for

mobile www.softacad.bg

slide-34
SLIDE 34
  • It’s too new
  • There is no security model
  • Too slow for building views
  • Doesn’t support fancy SQL queries
  • Doesn’t support fancy SQL queries

www.softacad.bg

slide-35
SLIDE 35

Get it from here: Get it from here:

http://couchdb.apache.org/downloads.html

Case studies :

http://www.couchbase.com/customers/case- studies

Practice Map Reduce: Practice Map Reduce:

http://blog.mudynamics.com/wp- content/uploads/2009/04/icouch.html

www.softacad.bg

slide-36
SLIDE 36

www.softacad.bg

slide-37
SLIDE 37

1.

Introduction to MongoDB

2.

Create, Update, Remove Operations

2.

Create, Update, Remove Operations

3.

Querying MongoDB

4.

Concurrency

5.

Indexes

6.

Aggregation

7.

Replication (Sharding)

7.

Replication (Sharding)

8.

Pros and cons

www.softacad.bg

slide-38
SLIDE 38

Scale out rather than scale down Replace the row with the more flexible Replace the row with the more flexible

document

Built for speed Drivers available for large range of

programming languages

Almost no administration needed

www.softacad.bg

slide-39
SLIDE 39

Create Update Update Delete

www.softacad.bg

slide-40
SLIDE 40

find and findOne Query Criteria and Conditionals Query Criteria and Conditionals Type – Specific Queries $where

www.softacad.bg

slide-41
SLIDE 41

Database level locking Yielding Yielding

www.softacad.bg

slide-42
SLIDE 42

Almost identical to relational database

indexes indexes

Geospatial indexes

www.softacad.bg

slide-43
SLIDE 43

count distinct distinct group Map/Reduce

www.softacad.bg

slide-44
SLIDE 44

Master-Slave Replication Sharding Sharding

www.softacad.bg

slide-45
SLIDE 45

Pros: scalable, fast, flexible, almost

administration free administration free

Cons: no atomic operations, no validation

www.softacad.bg

slide-46
SLIDE 46

CouchDB vs. MongoDB

MVCC (Multiversion concurrency control) Horizontal scalability Horizontal scalability Query Expression Atomicity Durability Map Reduce Javascript Javascript REST Performance Use cases

slide-47
SLIDE 47

www.softacad.bg

slide-48
SLIDE 48

nikolay.tomitov nikolay.tomitov @softacad.bg

www.softacad.bg

danail.alexiev @softacad.bg