38
WHY Shankar Morwal CTO and Founder Habilelabs.io

Why MongoDB over other Databases - Habilelabs

Embed Size (px)

Citation preview

WHY

Shankar MorwalCTO and Founder

Habilelabs.io

CONTENTS

1. Growth of Mongodb

2. Flexible data Model

3. MongoDB features

4. Rich set drivers and connectivity

5. Availability & Uptime

6. Security

Facebook

LinkedInGoogle

Twitter

Fastest-Growing Database

RANK DBMS MODEL SCORE GROWTH (20 MO)

1. Oracle Relational DBMS 1,442 -5%

2. MySQL Relational DBMS 1,294 2%

3. Microsoft SQL Server Relational DBMS 1,131 -10%

4. MongoDB Document Store 277 172%

5. PostgreSQL Relational DBMS 273 40%

6. DB2 Relational DBMS 201 11%

7. Microsoft Access Relational DBMS 146 -26%

8. Cassandra Wide Column 107 87%

9. SQLite Relational DBMS 105 19%

Source: DB-engines database popularity rankings; May 2015

Only non-relational in the top 5; 2.5x ahead of nearest NoSQL Competitor

4th Most Popular Database

FLEXIBLE DATA MODEL

DEVELOPER COSTS ON THE RISE

Storage Cost per GB Developer Salary

$0

$20,000

$40,000

$60,000

$80,000

$100,000

1985 2013

$100,000

$0.05$0

$20,000

$40,000

$60,000

$80,000

$100,000

$120,000

1985 2013

OPTIMIZING FOR ENGINEERING PRODUCTIVITY1985 2016

Infrastructure Cost

Engineer Cost

{

first_name: ‘Paul’,

surname: ‘Miller’,

city: ‘London’,

location: [45.123,47.232],

cars: [

{ model: ‘Bentley’,

year: 1973,

value: 100000, … },

{ model: ‘Rolls Royce’,

year: 1965,

value: 330000, … }

]

}

MongoDB

DOCUMENT MODEL WITH FLEXIBLE SCHEMARDBMS

DOCUMENTS ARE RICH DATA STRUCTURES

{

first_name: ‘Paul’,

surname: ‘Miller’,

cell: 447557505611,

city: ‘London’,

location: [45.123,47.232],

Profession: [‘banking’, ‘finance’, ‘trader’],

cars: [

{ model: ‘Bentley’,

year: 1973,

value: 100000, … },

{ model: ‘Rolls Royce’,

year: 1965,

value: 330000, … }

]

}

Fields can contain an array

of sub-documents

Fields

Typed field values

Fields can contain arrays

Number

DEVELOPMENT – THE PAST

DEVELOPMENT – WITH MONGODB

MONGODB IS FULL FEATURED

Rich Queries

• Find Paul’s cars

• Find everybody in London with a car between

1970 and 1980

Geospatial• Find all of the car owners within 5km of

Trafalgar Sq.

Text Search• Find all the cars described as having leather

seats

Aggregation• Calculate the average value of Paul’s car

collection

Map Reduce

• What is the ownership pattern of colors by

geography over time (is purple trending in

China?)

DYNAMIC LOOKUP

Combine data from multiple collections with

left outer joins for richer analytics & more

flexibility in data modeling

MODEL OF THE AGGREGATION FRAMEWORK

RICHER IN-DATABASE ANALYTICS & SEARCH

New Aggregation operators extend options

for performing analytics with lower developer

complexity

Array Operators Math Operators Text

• $slice

• $arrayElemAt

• $concatArrays

• $filter

• $min

• $max

• $avg

• $sum

• and more …

• $stdDevSamp

• $stdDevPop

• $sqrt

• $abs

• $trunc

• $ceil

• $floor

• $log

• $pow

• $exp

• and more …

• Case sensitive

text search

• Support for

languages such

as Arabic, Farsi,

Chinese and

more …

RICH SET DRIVERS AND CONNECTIVITY

DRIVERS & FRAMEWORKS

MEAN Stack

Java Python PerlRuby

ANALYTICS AND BI INTEGRATION

MONGODB CONNECTOR FOR BI

Visualize and explore multi-structured data

using SQL-based BI platforms.

Your BI Platform

BI ConnectorProvides Schema

Translates Queries

Translates Response

HIGH AVAILABILITY & UPTIME

REPLICA SETS

• Replica set – 2 to 50 copies

• Makes up a self-healing ‘shard’

• Data center aware

• Addresses:

– High availability

– Data durability, consistency

– Maintenance (e.g., HW swaps)

– Disaster Recovery A Single

Shard

REPLICA SET - INITIALIZE

Node 1

(Primary)

Node 2

(Secondary)

Node 3

(Secondary)

Replication Replication

Heartbeat

REPLICA SET - FAILURE

Node 2

(Secondary)

Node 3

(Secondary)Heartbeat

Primary Election

Node 1

(Primary)

REPLICA SET - FAILOVER

Node 1

(Primary)

Node 2

(Primary)

Node 3

(Secondary)

Heartbeat

Replication

REPLICA SET - RECOVERY

Node 2

(Primary)

Node 3

(Secondary)

Heartbeat

Replication

Node 1

(Recovery)

Replication

REPLICA SET - RECOVERED

Node 2

(Primary)

Node 3

(Secondary)

Heartbeat

Replication

Node 1

(Secondary)

Replication

ELASTIC SCALABILITY

ELASTIC SCALABILITY WITH AUTOMATIC SHARDING

• Increase or decrease capacity as you go

• Automatic load balancing

• Three types of sharding

– Hash-based

– Range-based

– Tag-aware

QUERY ROUTING

• Multiple query optimization models

• Each of the sharding options are

appropriate for different apps / use

cases

DESIGNED FOR PERFORMANCE

Better Data Locality In-Memory Caching In-Place Updates

vs.

Relational MongoDB

PERFORMANCE AT SCALE

Top 5 Marketing Firm Government Agency Top 5 Investment Bank

Data Key / Value 10+ fields, arrays, nested documents 20+ fields, arrays, nested documents

Queries• Key-based• 1-100 docs/query• 80/20 read/write

• Compound queries• Range queries• MapReduce• 20/80 read/write

• Compound queries• Range queries• 50/50 read/write

Servers ~250 ~50 4

Operations / Second

1,200,000 500,000 30,000

PERFORMANCE AT SCALE

Cluster Scale Performance Scale Data Scale

Entertainment Co.

1400 servers 250M Ticks / Sec Petabytes

Asian Internet Co.

1000+ servers 300K+ Ops / Sec 10s of billions of objects

250+ servers Fed Agency 500K+ Ops / Sec 13B documents

SECURITY

ENTERPRISE-GRADE SECURITY

*Included with MongoDB Enterprise Advanced

BUSINESS NEEDS SECURITY FEATURES

Authentication SCRAM, LDAP*, Kerberos*, x.509 Certificates

Authorization Built-in Roles, User-Defined Roles, Field-Level Redaction

Auditing* Admin, DML, DDL, Role-based

Encryption Network: SSL (with FIPS 140-2), Disk: Encrypted Storage Engine* or Partner Solutions

Questions ?For any questions drop me line at [email protected]

CONTACT US

• Development Center :Habilelabs Pvt. Ltd.4th Floor, I.G.M. Senior Secondary Public School Campus,Sec-93 Agarwal Farm, Mansarovar, Jaipur(Raj.) – 302020

• Email : [email protected]

• Web : https://habilelabs.io

• Telephone: +91-9828247415 / +91-9887992695