building social inbox, using mongodb

Download Building Social Inbox, using MongoDB

Post on 15-Jul-2015

834 views

Category:

Technology

2 download

Embed Size (px)

TRANSCRIPT

PowerPoint Presentation

Building A Practical Social InboxUsing MongoDBDec 9th , 201410. 30 am EST

#suyatiwebinar

2OURSPEAKER

3

@suyatitechSuyatiTechnologies+SuyatiTheSuyatisuyati-technologies-private-limited#suyatiwebinar

Introduction to MongoDBWhat are Social Inboxes? What are the different types of Social Inboxes?Challenges in building Social InboxesPatterns for building Social InboxesImplementing a Write intensive Social InboxIntroduction to MongologueOURAGENDAHumongous Data

PERFORMANCE, AVAILABILITY, AUTO-SCALING

http://www.mongodb.org/downloads

http://try.mongodb.org

http://docs.mongodb.org/manual

MONGODB

MongoDB stores data in the form of documentsMongoDB stores all documents in collections. Collections are analogous to tables in Relational DBsA Message TimelineA Post FeedConversation Log

WHAT ISSOCIALINBOX

Read/Write requestsVolumePerformance

Real Time User ExperienceCONSIDERATIONSCreates Posts (Write)Reads Timeline (Read)Follows Other Users Gets Followed by other Users

A USER

Real Time Writes and ReadsSorting PostsPaging and Delivery

ANINBOXAn Average Tweet makes it to about 254 inboxes

Duplication for performanceParallel for scalabilityTHE MYTH OFNORMALIZED DATA

Fan-out on ReadFan-out on WriteFan-out on Write with Buckets

SCHEMADESIGNSSCHEMASFan out on ReadFan out on WriteSend Message PerformanceBestGoodShard per recipientMultiple writesRead Inbox PerformanceWorstBroadcast all shardsRandom readsGoodSingle shardRandom readsData SizeBestMessage stored onceWorstCopy per recipientvar user = {"name": "john", "id": 1}show collectionsdb.testUsers.save(user)show collectionsdb.testUsers.find()

SOMECODE

Ensuring everything's at arm's lengthLETS TALKSCHEMACreates Posts (Write)Reads Timeline (Read)Follows Other Users Gets Followed by other Users

A USERvar user = { "name": "john", "followers":[], "following":[]}db.users.save(user)db.users.find()THEUSERDOCUMENTvar post = { "from": "john", "date":new Date(), "message":"hello"}

THEPOSTDOCUMENTdb.shardCollection("mongodbdays.inbox", {"recipient": 1, "sent":1})

var post = { "from": "john", "date":new Date(), "message":"hello"}

var user = db.users.findOne({name: post.from})

for(follower in user.followers) { post.to = follower; db.inbox.insert(post)}CREATING APOSTdb.inbox.find ({to: "john"}).sort({ sent:-1})RETREIVING THEPOSTA shard is a replica set or a single mongod that contains a subset of the data for the sharded cluster. SHARDS

db.shardCollection("test.inbox", {"to": 1, "sent":1}) SHARDSGroupsUnfollow / BlockMedia in PostsComments, Likes

https://github.com/suyati/mongologue

GOINGFURTHERTo access the recording please click here

THANK YOUPlease feel free to share this information