Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
287 lines (170 sloc) 4.12 KB

title: Hands on with MongoDB on Cloud Foundry

!SLIDE

<% left do %> <%= include "../shared/us/monica.md" %> <% end %>

<% right do %> main <% end %>

!SLIDE

Agenda

Why MongoDB ?

MongoDB on Cloud Foundry

A practical example using NodeJS

!SLIDE vcenterH2

Why MongoDB ?

!SLIDE

Data

Volumes are increasing 60% a year

Varies widely

Exchange done via messaging SOA

!SLIDE

RDBMS technology is under duress

Sharding of data is external to the RDBMS

Traditional RDBMS scaling is vertical not horizontal

Database replication is expensive and difficult

  • Oracle RAC clustering is very expensive.
  • $70K/CPU according to list. Even at ½ the cost, it’s still really expensive to build out a horizontal data access grid.

!SLIDE

Heterogeneous

ACID semantics are not needed for every use case

BASE semantics are a viable option

(Basically Available, Soft state, Eventually consistent)

  • Online Banking : ACID
  • Facebook Updates: BASE

Data has changed

Distributed applications mean distributed data

Consistency is relative

!SLIDE

NoSQL means

Non-relational, next-generation operational datastores and databases

Focus on scalability

Ease of modeling and changing data

!SLIDE vcenterH2

NoSQL Options

!SLIDE

<% left do %>

Key Value

Redis

  • Data structures in RAM
  • BS Strings, lists, sets, sorted sets, hashes
  • Union, intersection, difference, order
  • Competition: single thread / async
  • Replication: master / slave / slave
  • High performance site: 100,000 + RW / s <% end %>

<% right do %> main <% end %>

Riak

  • BLOBs
  • S3-like: it stores and serves straight through HTTP
  • DW: large volumes, Proc. offline

!SLIDE

<% left do %>

Column

Cassandra

HBase

<% end %>

<% right do %> main <% end %>

!SLIDE

<% left do %>

Document

MongoDB

main

CouchDB

<% end %>

<% right do %> main <% end %>

<% left do %>

Graph

neo4j

<% end %>

<% right do %> main <% end %>

!SLIDE vcenterH2

MongoDB

!SLIDE

Stores JSON-style documents

{ hello: “world” }

Represented as BSON

\x16\x00\x00\x00\x02hello\x00
\x06\x00\x00\x00world\x00\x00

!SLIDE

Flexible Schemas

{
author: “mike”,
links: 3,
date: "Sun Jul 18 2010 14:40:20 GMT-0700 (PDT)"
text: “blah blah”
}

{
author: “eliot”,
date: "Sun Jul 18 2010 14:40:22 GMT-0700 (PDT)"
text: “Here is MongoDB ...”,
views: 10
}

links: 3 vs views: 10

!SLIDE

Embedded Document

{
 _id: ObjectId("4d1009c7262bb4b94af1cea4")
 author_id: “1346”,
 date: "Sun Jul 18 2010 14:40:20 GMT-0700 (PDT)",
 title: “my story”
 text: “once upon a time ...”,
 tags: [“novel”,”english”],
 Comments:[
 {user_id: 234, text: “awesome dude”},
 {user_id: 1235, text: “that made me cry”}]
}

!SLIDE vcenterH2

Little need for joins or transactions across documents

!SLIDE

Horizontally scalable

main

!SLIDE

Full Indexing Support

Unique

Compound

Geo

!SLIDE

BLOBs: GridFS

Main use case is Large Files

Just as easy to use as the File System

http://api.mongodb.org/ruby/current/file.GridFS.html

!SLIDE

Replication & Sharding

Using Replica Set:

  • pool of servers with 1 master
  • automatic master election and failover
  • distributed reads (slaveOk)

Sharding

  • For large datasets, or write heavy system

main

!SLIDE

Open Source

  • Great community

Many drivers

  • PHP, Java, Ruby, Erlang, Python, NodeJS

Object Relational Mappers too

  • Mongoose for NodeJS
  • Mongo Mapper and Mongoid for Ruby

!SLIDE

MongoDB on Cloud Foundry

MongoDB version 1.8

Indexing and querying

As many collections as needed

GridFS Support

No replication or sharing currently

!SLIDE vcenterH2

A practical example

!SLIDE vcenterH2

Questions ?

!SLIDE

Credits