53
S Q L OR NoSQL That’s THE Ques.on

SQL or NoSQL - TrueNorthPHP

Embed Size (px)

Citation preview

Page 1: SQL or NoSQL - TrueNorthPHP

S Q LORNoSQL

That’sT H E Ques.on

Page 2: SQL or NoSQL - TrueNorthPHP

@majidfnMajiD FatemianUbisoft Montreal

Page 3: SQL or NoSQL - TrueNorthPHP

BIGDATA

Page 4: SQL or NoSQL - TrueNorthPHP

NoSQL

Page 5: SQL or NoSQL - TrueNorthPHP

1 2 3

No SQL Cluster Schemaless

Page 6: SQL or NoSQL - TrueNorthPHP

Fitness Evolved

Page 7: SQL or NoSQL - TrueNorthPHP

Fitness Evolved

Page 8: SQL or NoSQL - TrueNorthPHP

2.2M 10K 160K(Max)40K (Avg)

Users Concurrent Daily Activities

STATS

Page 9: SQL or NoSQL - TrueNorthPHP

2011

2012

2013

Page 10: SQL or NoSQL - TrueNorthPHP

2011

2012

2013

Page 11: SQL or NoSQL - TrueNorthPHP

Architecture2011

Page 12: SQL or NoSQL - TrueNorthPHP

SQL / JOINACID

TransactionPartitioningReplication

ToolsOPs

Data Modeling

+

Page 13: SQL or NoSQL - TrueNorthPHP

2011

2012

2013

Page 14: SQL or NoSQL - TrueNorthPHP

Profile Info.

SpecificGlobal

Aggregated stats Activities

DATA

Community Events

Details

Leaderboards

Page 15: SQL or NoSQL - TrueNorthPHP

SQL / JOINACID

TransactionPartitioningReplication

ToolsOPs

Data Modeling

VolumeNo DetailsVariant SchemaPartitioningScale outSharding

+ -

Page 16: SQL or NoSQL - TrueNorthPHP

SQL / JOINACID

TransactionPartitioningReplication

ToolsOPs

Data Modeling

VolumeNo DetailsVariant SchemaPartitioningScale outSharding

+ -{ player_id: 1234, game_id: 4001, platform: xbox360, calories: 40, duration: 75, difficulty_level: medium, jumping_ropes: 178, score: 450, endurance:3, category: 4}

{ player_id: 1234, game_id: 1002, platform: wiiu, calories: 75, duration: 120} *

***

xbox v.1 xbox v.2Variant Schema

Page 17: SQL or NoSQL - TrueNorthPHP

SQL / JOINACID

TransactionPartitioningReplication

ToolsOPs

Data Modeling

VolumeNo DetailsVariant SchemaPartitioningScale outSharding

+ -Scale out

Page 18: SQL or NoSQL - TrueNorthPHP

SQL / JOINACID

TransactionPartitioningReplication

ToolsOPs

Data Modeling

VolumeNo DetailsVariant SchemaPartitioningScale outSharding

+ -Sharding

Data CData B

Data A

Data Access Layer

Page 19: SQL or NoSQL - TrueNorthPHP

SQL / JOINACID

TransactionPartitioningReplication

ToolsOPs

Data Modeling

VolumeNo DetailsVariant SchemaPartitioningScale outSharding

+ -

Page 20: SQL or NoSQL - TrueNorthPHP

NoSQL

...

Page 21: SQL or NoSQL - TrueNorthPHP

mongoDB

1 2 3

OPs Support Community

Page 22: SQL or NoSQL - TrueNorthPHP

Schema-LessAggregated DataObject MappingLarge Scale Data

ShardingMap/Reduce

Eventual ConsistencyMemory Storage

Journaling

+

Page 23: SQL or NoSQL - TrueNorthPHP

Aggregated DataObject MappingLarge Scale Data

ShardingMap/Reduce

Eventual ConsistencyMemory Storage

Journaling

Schema-Less

{ player_id: 1234, game_id: 4001, platform: xbox360, calories: 40, duration: 75, difficulty_level: medium, jumping_ropes: 178, score: 450, endurance:3, category: 4}

{ player_id: 1234, game_id: 1002, platform: wiiu, calories: 75, duration: 120} *

***

xbox v.1 WiiU

+

Page 24: SQL or NoSQL - TrueNorthPHP

Schema-Less

Large Scale DataSharding

Map/ReduceEventual Consistency

Memory StorageJournaling

Aggregated DataObject Mapping

{ player: { name: example, gender: M, country:CA } game_id: 4001, date: “2013-11-08”, calories: 40, duration: 75,}

+

Page 25: SQL or NoSQL - TrueNorthPHP

Schema-LessAggregated DataObject Mapping

Eventual ConsistencyMemory Storage

Journaling

+

Large Scale DataSharding

Map/Reduce

Data AData B

Data C

Page 26: SQL or NoSQL - TrueNorthPHP

Schema-LessAggregated DataObject MappingLarge Scale Data

ShardingMap/Reduce

Eventual ConsistencyMemory Storage

Journaling

+

Page 27: SQL or NoSQL - TrueNorthPHP

Denormalized dataDisk SpaceExpertiseComplex QueryingResource UsageDB-Level Locking

-

Schema-LessAggregated DataObject MappingLarge Scale Data

ShardingMap/Reduce

Eventual ConsistencyMemory Storage

Journaling

+

Page 28: SQL or NoSQL - TrueNorthPHP

BENCHMARK

Page 29: SQL or NoSQL - TrueNorthPHP

Random ProfileSearch

(1M)

Full HistoryRetrieval

(6M)

Insert(6M)

AggregationMap/Reduce

(6M)

0

0.005

0.01

0.015

0.02

MySQLMongoDB

Page 30: SQL or NoSQL - TrueNorthPHP

Relational Data ModelEase of Use

Schema LessPerformanceSharding

Page 31: SQL or NoSQL - TrueNorthPHP

GO!Hybrid

Page 32: SQL or NoSQL - TrueNorthPHP

Master

Slave

Config Server

Shard 1Replicaset

Shard 2Replicaset

Page 33: SQL or NoSQL - TrueNorthPHP

Concerns

Inconsistency!

2

3

4

Data Duplication

Consistency vs. Latency

Complexity

Page 34: SQL or NoSQL - TrueNorthPHP

Challenges

Availability

! 2

Time

3

Expertese

Page 35: SQL or NoSQL - TrueNorthPHP

Data Access Layer

OR

Page 36: SQL or NoSQL - TrueNorthPHP

FailureBackup

Plans

Page 37: SQL or NoSQL - TrueNorthPHP

DATAMigration

Page 38: SQL or NoSQL - TrueNorthPHP
Page 39: SQL or NoSQL - TrueNorthPHP

1 One Shot Migration

2 Profile Versioning

4 hrs !!Live!

Page 40: SQL or NoSQL - TrueNorthPHP

Read

Write

Page 41: SQL or NoSQL - TrueNorthPHP

TEST!

Page 42: SQL or NoSQL - TrueNorthPHP

2Functional

3Integration

1Unit

Page 43: SQL or NoSQL - TrueNorthPHP

FinalResults

Page 44: SQL or NoSQL - TrueNorthPHP

Scalability

&...

Page 45: SQL or NoSQL - TrueNorthPHP

B.I.User

Details

Page 46: SQL or NoSQL - TrueNorthPHP

Response Time

0.02 0.0002” ”

Page 47: SQL or NoSQL - TrueNorthPHP

Architecture2013

REST

Page 48: SQL or NoSQL - TrueNorthPHP

> 1 year uptime

Page 49: SQL or NoSQL - TrueNorthPHP

1

2

Based on Requirements

Benchmark!

3 Choose Wisely!

Page 50: SQL or NoSQL - TrueNorthPHP

ThankYOU!

@majidfnhttps://joind.in/9977

Page 51: SQL or NoSQL - TrueNorthPHP

References

NoSQLDistilled

MongoDBThe definitive guide

MySQLHigh Performance

Page 52: SQL or NoSQL - TrueNorthPHP

we needYOU!

http://montreal.ubisoft.com/en/video-games-jobs-my-career

Page 53: SQL or NoSQL - TrueNorthPHP

@majidfn

Q?Got