SlideShare une entreprise Scribd logo
1  sur  25
Télécharger pour lire hors ligne
Building a Social Network with MongoDB
                                                   Brian Zambrano

                                                       MongoSV
                                                 December 3, 2010




                                                              1

Friday, December 3, 2010
Eventbrite Brand Tenets




                            2

Friday, December 3, 2010
Eventbrite Brand Tenets




                            3

Friday, December 3, 2010
Social Recommendations




                           4

Friday, December 3, 2010
Eventbriteʼs Social Graph




                              5

Friday, December 3, 2010
Eventbriteʼs Social Graph




                              6

Friday, December 3, 2010
Neighbors




                           7

Friday, December 3, 2010
Challenges

        • Dynamic
                • Neighbors change often
                • Neighborsʼ events change often
        • Flexibility
                • Want to incorporate other social graphs
                • Product may evolve quickly
        • Performance
                • We need really fast reads
                • Frequent writes
                                                            8

Friday, December 3, 2010
Why MongoDB?

        • Performance
        • Flexible schema design
        • Easy to work with
        • We felt comfortable MongoDB would mature as
              our needs became more demanding




                                                    9

Friday, December 3, 2010
Providing Recommendations

        1. User visits http://eventbrite.com/mytickets/
        2. Fetch neighbors
        3. Fetch neighborsʼ events
        4. Score each possible event
        5. Return recommendations




                                                          10

Friday, December 3, 2010
MongoDB setup

        • One non-sharded replica set
                • Two DBs on Large EC2 instances
                • One arbiter
        • Three collections
                • Users
                • Events
                • Orders


                                                   11

Friday, December 3, 2010
User Data in MongoDB

                { "_id": 4558992,   Unique User Id
                }




                                                     12

Friday, December 3, 2010
User Data in MongoDB

                { "_id": 4558992,
                  "events" : {
                      "all_ids": [ 116706, 179487, 16389, 827496 ],
                      "curr_ids": [ 827496 ],

                }
                  },
                                                     Past and current
                                                     attendance




                                                                        13

Friday, December 3, 2010
User Data in MongoDB

                { "_id": 4558992,
                   "events" : {
                        "all_ids": [ 116706, 179487, 16389, 827496 ],
                        "curr_ids": [ 827496 ],
                   },
                  "nns" : [
                      [ 2816442, 0.2 ],
                      [ 1615962, 0.047619047619047616 ],
                    ],
                }                                    Nearest neighbors
                                                     (user_id, score)



                                                                         14

Friday, December 3, 2010
User Data in MongoDB

                { "_id": 4558992,
                   "events" : {
                        "all_ids": [ 116706, 179487, 16389, 827496 ],
                        "curr_ids": [ 827496 ],
                   },
                  "nns" : [
                      [ 2816442, 0.2 ],
                      [ 1615962, 0.047619047619047616 ],
                     ],
                  "fb" : {
                        "_id" : 4808871,          Facebook data
                        "name" : "Brian Zambrano",
                        "location" : "San Francisco, California",
                        "friends" : [ 568876525, 569507467, 569559792 ],
                  },
                }

                                                                           15

Friday, December 3, 2010
MongoDB Indexes

                { "_id": 4558992,
                   "events" : {
                        "all_ids": [ 116706, 179487, 16389, 827496 ],
                        "curr_ids": [ 827496 ],
                   },
                  "nns" : [
                      [ 2816442, 0.2 ],
                      [ 1615962, 0.047619047619047616 ],
                     ],
                  "fb" : {
                        "_id" : 4808871,
                        "name" : "Brian Zambrano",
                        "location" : "San Francisco, California",
                        "friends" : [ 568876525, 569507467, 569559792],
                  },
                }

                                                                          16

Friday, December 3, 2010
Events Collection
        > db.events.findOne({_id: 799177})
        {
           "_id" : 799177,
           "uid" : 2989008,
           "title" : "MongoSV",
           "venue" : {
                   "loc" : [
                            37.413042,
                            -122.071106
                   ],
                   "state" : "CA",
                   "id" : 508093,
                   "city" : "Mountain View"
           },
           "logo" : "758915938.png",
           "shortname" : "mongosv",
           "start_date" : "Fri Dec 03 2010 01:00:00 GMT-0800 (PST)"
        }

                                                                      17

Friday, December 3, 2010
Orders Collection
        > db.orders.find({_eid: 799177})
        { "_id" : 17464215, "_uid" : 1111195, "_eid" : 799177 }
        { "_id" : 17575729, "_uid" : 6970539, "_eid" : 799177 }
        { "_id" : 17582343, "_uid" : 3092687, "_eid" : 799177 }
        { "_id" : 17588693, "_uid" : 2255017, "_eid" : 799177 }
        { "_id" : 17589589, "_uid" : 6976917, "_eid" : 799177 }
        { "_id" : 17601979, "_uid" : 885441, "_eid" : 799177 }
        { "_id" : 17603085, "_uid" : 2500199, "_eid" : 799177 }
        { "_id" : 17608289, "_uid" : 6984367, "_eid" : 799177 }
        { "_id" : 17681965, "_uid" : 628459, "_eid" : 799177 }
        { "_id" : 17684489, "_uid" : 7017999, "_eid" : 799177 }
        { "_id" : 17689673, "_uid" : 7020133, "_eid" : 799177 }
        { "_id" : 17728267, "_uid" : 7036607, "_eid" : 799177 }
        has more




                                                                  18

Friday, December 3, 2010
Recommended Events Query

               Two + n queries
                  1. Get neighbors
                           nns = db.users.find({_id : {$in : user.nn_ids}})

                  2. Get possible event recommendations:
                           db.events.find({_id : {$in : nns.events.all}})


                  n.For each event, get total attendee count
                           db.orders.find({_eid : event_id})




                                                                              19

Friday, December 3, 2010
Recommended Events Query

               Two + n queries
                  1. Get neighbors
                           nns = db.users.find({_id : {$in : user.nn_ids}})

                  2. Get possible event recommendations:
                           db.events.find({_id : {$in : nns.events.all}})


                  n.For each event, get total attendee count
                           db.orders.find({_eid : event_id})


                                      Optimization opportunity:
                                       Embed orders in Event records


                                                                              20

Friday, December 3, 2010
Updating Neighbors
               Two queries, one update
                  1. Get all orders for a userʼs past events:
                           uids = db.orders.find({_id : {$in : user.events.all}})

                  2. Get all neighbors:
                           nns = db.users.find({_id : {$in : uids}})

                  ➡Score neighbors
                  3. Update nn_ids
                           db.users.update({_id : uid},
                                           {$set : {nn_ids: nn}})



                                                                                    21

Friday, December 3, 2010
Facebook Friendʼs Events
               Two queries
                  1. Get FB friends
                           db.users.find({fb._id : {$in : fb.friends}})

                  2. Get events FB friends are attending
                           db.events.find({_id : {$in : fb_friends_events}})




                                                                               22

Friday, December 3, 2010
The Future

        • Incorporate other social networks
        • Iterate scoring algorithm
        • Count recommendation impressions




                                              23

Friday, December 3, 2010
Weʼre hiring!
                           http://www.eventbrite.com/jobs/




                                                             24

Friday, December 3, 2010
Thanks!

        Brian Zambrano <brianz@eventbrite.com>

        Eventbriteʼs new Facebook recommendations power
          social event discovery: http://bit.ly/gRVS7I

        Social Commerce: A First Look at the Numbers:
          http://bit.ly/gXeg9Q




                                                          25

Friday, December 3, 2010

Contenu connexe

Tendances

Building web applications with mongo db presentation
Building web applications with mongo db presentationBuilding web applications with mongo db presentation
Building web applications with mongo db presentationMurat Çakal
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDBrogerbodamer
 
MongoDB Schema Design
MongoDB Schema DesignMongoDB Schema Design
MongoDB Schema DesignAlex Litvinok
 
Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012hungarianhc
 
Socialite, the Open Source Status Feed Part 2: Managing the Social Graph
Socialite, the Open Source Status Feed Part 2: Managing the Social GraphSocialite, the Open Source Status Feed Part 2: Managing the Social Graph
Socialite, the Open Source Status Feed Part 2: Managing the Social GraphMongoDB
 
Back to Basics 1: Thinking in documents
Back to Basics 1: Thinking in documentsBack to Basics 1: Thinking in documents
Back to Basics 1: Thinking in documentsMongoDB
 
Socialite, the Open Source Status Feed Part 3: Scaling the Data Feed
Socialite, the Open Source Status Feed Part 3: Scaling the Data FeedSocialite, the Open Source Status Feed Part 3: Scaling the Data Feed
Socialite, the Open Source Status Feed Part 3: Scaling the Data FeedMongoDB
 
Building your first app with mongo db
Building your first app with mongo dbBuilding your first app with mongo db
Building your first app with mongo dbMongoDB
 
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...MongoDB
 
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentos
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentosConceptos básicos. seminario web 3 : Diseño de esquema pensado para documentos
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentosMongoDB
 
Data Modeling for the Real World
Data Modeling for the Real WorldData Modeling for the Real World
Data Modeling for the Real WorldMike Friedman
 
Agile Schema Design: An introduction to MongoDB
Agile Schema Design: An introduction to MongoDBAgile Schema Design: An introduction to MongoDB
Agile Schema Design: An introduction to MongoDBStennie Steneker
 
Back to Basics Webinar 3 - Thinking in Documents
Back to Basics Webinar 3 - Thinking in DocumentsBack to Basics Webinar 3 - Thinking in Documents
Back to Basics Webinar 3 - Thinking in DocumentsJoe Drumgoole
 
Real-time Location Based Social Discovery using MongoDB
Real-time Location Based Social Discovery using MongoDBReal-time Location Based Social Discovery using MongoDB
Real-time Location Based Social Discovery using MongoDBFredrik Björk
 
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...MongoDB
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDBNate Abele
 
Building Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata CatalogBuilding Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata Cataloghungarianhc
 
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial IndexesBack to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial IndexesMongoDB
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationMongoDB
 

Tendances (19)

Building web applications with mongo db presentation
Building web applications with mongo db presentationBuilding web applications with mongo db presentation
Building web applications with mongo db presentation
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
 
MongoDB Schema Design
MongoDB Schema DesignMongoDB Schema Design
MongoDB Schema Design
 
Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012
 
Socialite, the Open Source Status Feed Part 2: Managing the Social Graph
Socialite, the Open Source Status Feed Part 2: Managing the Social GraphSocialite, the Open Source Status Feed Part 2: Managing the Social Graph
Socialite, the Open Source Status Feed Part 2: Managing the Social Graph
 
Back to Basics 1: Thinking in documents
Back to Basics 1: Thinking in documentsBack to Basics 1: Thinking in documents
Back to Basics 1: Thinking in documents
 
Socialite, the Open Source Status Feed Part 3: Scaling the Data Feed
Socialite, the Open Source Status Feed Part 3: Scaling the Data FeedSocialite, the Open Source Status Feed Part 3: Scaling the Data Feed
Socialite, the Open Source Status Feed Part 3: Scaling the Data Feed
 
Building your first app with mongo db
Building your first app with mongo dbBuilding your first app with mongo db
Building your first app with mongo db
 
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...
 
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentos
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentosConceptos básicos. seminario web 3 : Diseño de esquema pensado para documentos
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentos
 
Data Modeling for the Real World
Data Modeling for the Real WorldData Modeling for the Real World
Data Modeling for the Real World
 
Agile Schema Design: An introduction to MongoDB
Agile Schema Design: An introduction to MongoDBAgile Schema Design: An introduction to MongoDB
Agile Schema Design: An introduction to MongoDB
 
Back to Basics Webinar 3 - Thinking in Documents
Back to Basics Webinar 3 - Thinking in DocumentsBack to Basics Webinar 3 - Thinking in Documents
Back to Basics Webinar 3 - Thinking in Documents
 
Real-time Location Based Social Discovery using MongoDB
Real-time Location Based Social Discovery using MongoDBReal-time Location Based Social Discovery using MongoDB
Real-time Location Based Social Discovery using MongoDB
 
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDB
 
Building Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata CatalogBuilding Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata Catalog
 
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial IndexesBack to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB Application
 

Similaire à Building a Social Network with MongoDB

Building a Social Network with MongoDB
Building a Social Network with MongoDBBuilding a Social Network with MongoDB
Building a Social Network with MongoDBLewis Lin 🦊
 
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...MongoDB
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB
 
MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...
MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...
MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...MongoDB
 
Big Data Analytics 1: Driving Personalized Experiences Using Customer Profiles
Big Data Analytics 1: Driving Personalized Experiences Using Customer ProfilesBig Data Analytics 1: Driving Personalized Experiences Using Customer Profiles
Big Data Analytics 1: Driving Personalized Experiences Using Customer ProfilesMongoDB
 
First app online conf
First app   online confFirst app   online conf
First app online confMongoDB
 
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2Lisa Roth, PMP
 
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2MongoDB
 
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 Link
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 LinkMongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 Link
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 LinkMongoDB
 
Starting with MongoDB
Starting with MongoDBStarting with MongoDB
Starting with MongoDBDoThinger
 
Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling rogerbodamer
 
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2MongoDB
 
MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...MongoDB
 
Strata London 16: sightseeing, venues, and friends
Strata  London 16: sightseeing, venues, and friendsStrata  London 16: sightseeing, venues, and friends
Strata London 16: sightseeing, venues, and friendsNatalino Busa
 
Mongo Web Apps: OSCON 2011
Mongo Web Apps: OSCON 2011Mongo Web Apps: OSCON 2011
Mongo Web Apps: OSCON 2011rogerbodamer
 
MongoDB .local London 2019: Best Practices for Working with IoT and Time-seri...
MongoDB .local London 2019: Best Practices for Working with IoT and Time-seri...MongoDB .local London 2019: Best Practices for Working with IoT and Time-seri...
MongoDB .local London 2019: Best Practices for Working with IoT and Time-seri...MongoDB
 

Similaire à Building a Social Network with MongoDB (20)

Building a Social Network with MongoDB
Building a Social Network with MongoDBBuilding a Social Network with MongoDB
Building a Social Network with MongoDB
 
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...
MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...
MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...
 
Internet of things
Internet of thingsInternet of things
Internet of things
 
Big Data Analytics 1: Driving Personalized Experiences Using Customer Profiles
Big Data Analytics 1: Driving Personalized Experiences Using Customer ProfilesBig Data Analytics 1: Driving Personalized Experiences Using Customer Profiles
Big Data Analytics 1: Driving Personalized Experiences Using Customer Profiles
 
First app online conf
First app   online confFirst app   online conf
First app online conf
 
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local London 2019: Using Client Side Encryption in MongoDB 4.2
 
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 Link
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 LinkMongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 Link
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 Link
 
Starting with MongoDB
Starting with MongoDBStarting with MongoDB
Starting with MongoDB
 
Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling
 
Awesome Tools 2017
Awesome Tools 2017Awesome Tools 2017
Awesome Tools 2017
 
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...
 
Strata London 16: sightseeing, venues, and friends
Strata  London 16: sightseeing, venues, and friendsStrata  London 16: sightseeing, venues, and friends
Strata London 16: sightseeing, venues, and friends
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Mongo Web Apps: OSCON 2011
Mongo Web Apps: OSCON 2011Mongo Web Apps: OSCON 2011
Mongo Web Apps: OSCON 2011
 
MongoDB .local London 2019: Best Practices for Working with IoT and Time-seri...
MongoDB .local London 2019: Best Practices for Working with IoT and Time-seri...MongoDB .local London 2019: Best Practices for Working with IoT and Time-seri...
MongoDB .local London 2019: Best Practices for Working with IoT and Time-seri...
 

Dernier

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Dernier (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Building a Social Network with MongoDB

  • 1. Building a Social Network with MongoDB Brian Zambrano MongoSV December 3, 2010 1 Friday, December 3, 2010
  • 2. Eventbrite Brand Tenets 2 Friday, December 3, 2010
  • 3. Eventbrite Brand Tenets 3 Friday, December 3, 2010
  • 4. Social Recommendations 4 Friday, December 3, 2010
  • 5. Eventbriteʼs Social Graph 5 Friday, December 3, 2010
  • 6. Eventbriteʼs Social Graph 6 Friday, December 3, 2010
  • 7. Neighbors 7 Friday, December 3, 2010
  • 8. Challenges • Dynamic • Neighbors change often • Neighborsʼ events change often • Flexibility • Want to incorporate other social graphs • Product may evolve quickly • Performance • We need really fast reads • Frequent writes 8 Friday, December 3, 2010
  • 9. Why MongoDB? • Performance • Flexible schema design • Easy to work with • We felt comfortable MongoDB would mature as our needs became more demanding 9 Friday, December 3, 2010
  • 10. Providing Recommendations 1. User visits http://eventbrite.com/mytickets/ 2. Fetch neighbors 3. Fetch neighborsʼ events 4. Score each possible event 5. Return recommendations 10 Friday, December 3, 2010
  • 11. MongoDB setup • One non-sharded replica set • Two DBs on Large EC2 instances • One arbiter • Three collections • Users • Events • Orders 11 Friday, December 3, 2010
  • 12. User Data in MongoDB { "_id": 4558992, Unique User Id } 12 Friday, December 3, 2010
  • 13. User Data in MongoDB { "_id": 4558992, "events" : { "all_ids": [ 116706, 179487, 16389, 827496 ], "curr_ids": [ 827496 ], } }, Past and current attendance 13 Friday, December 3, 2010
  • 14. User Data in MongoDB { "_id": 4558992, "events" : { "all_ids": [ 116706, 179487, 16389, 827496 ], "curr_ids": [ 827496 ], }, "nns" : [ [ 2816442, 0.2 ], [ 1615962, 0.047619047619047616 ], ], } Nearest neighbors (user_id, score) 14 Friday, December 3, 2010
  • 15. User Data in MongoDB { "_id": 4558992, "events" : { "all_ids": [ 116706, 179487, 16389, 827496 ], "curr_ids": [ 827496 ], }, "nns" : [ [ 2816442, 0.2 ], [ 1615962, 0.047619047619047616 ], ], "fb" : { "_id" : 4808871, Facebook data "name" : "Brian Zambrano", "location" : "San Francisco, California", "friends" : [ 568876525, 569507467, 569559792 ], }, } 15 Friday, December 3, 2010
  • 16. MongoDB Indexes { "_id": 4558992, "events" : { "all_ids": [ 116706, 179487, 16389, 827496 ], "curr_ids": [ 827496 ], }, "nns" : [ [ 2816442, 0.2 ], [ 1615962, 0.047619047619047616 ], ], "fb" : { "_id" : 4808871, "name" : "Brian Zambrano", "location" : "San Francisco, California", "friends" : [ 568876525, 569507467, 569559792], }, } 16 Friday, December 3, 2010
  • 17. Events Collection > db.events.findOne({_id: 799177}) { "_id" : 799177, "uid" : 2989008, "title" : "MongoSV", "venue" : { "loc" : [ 37.413042, -122.071106 ], "state" : "CA", "id" : 508093, "city" : "Mountain View" }, "logo" : "758915938.png", "shortname" : "mongosv", "start_date" : "Fri Dec 03 2010 01:00:00 GMT-0800 (PST)" } 17 Friday, December 3, 2010
  • 18. Orders Collection > db.orders.find({_eid: 799177}) { "_id" : 17464215, "_uid" : 1111195, "_eid" : 799177 } { "_id" : 17575729, "_uid" : 6970539, "_eid" : 799177 } { "_id" : 17582343, "_uid" : 3092687, "_eid" : 799177 } { "_id" : 17588693, "_uid" : 2255017, "_eid" : 799177 } { "_id" : 17589589, "_uid" : 6976917, "_eid" : 799177 } { "_id" : 17601979, "_uid" : 885441, "_eid" : 799177 } { "_id" : 17603085, "_uid" : 2500199, "_eid" : 799177 } { "_id" : 17608289, "_uid" : 6984367, "_eid" : 799177 } { "_id" : 17681965, "_uid" : 628459, "_eid" : 799177 } { "_id" : 17684489, "_uid" : 7017999, "_eid" : 799177 } { "_id" : 17689673, "_uid" : 7020133, "_eid" : 799177 } { "_id" : 17728267, "_uid" : 7036607, "_eid" : 799177 } has more 18 Friday, December 3, 2010
  • 19. Recommended Events Query Two + n queries 1. Get neighbors nns = db.users.find({_id : {$in : user.nn_ids}}) 2. Get possible event recommendations: db.events.find({_id : {$in : nns.events.all}}) n.For each event, get total attendee count db.orders.find({_eid : event_id}) 19 Friday, December 3, 2010
  • 20. Recommended Events Query Two + n queries 1. Get neighbors nns = db.users.find({_id : {$in : user.nn_ids}}) 2. Get possible event recommendations: db.events.find({_id : {$in : nns.events.all}}) n.For each event, get total attendee count db.orders.find({_eid : event_id}) Optimization opportunity: Embed orders in Event records 20 Friday, December 3, 2010
  • 21. Updating Neighbors Two queries, one update 1. Get all orders for a userʼs past events: uids = db.orders.find({_id : {$in : user.events.all}}) 2. Get all neighbors: nns = db.users.find({_id : {$in : uids}}) ➡Score neighbors 3. Update nn_ids db.users.update({_id : uid}, {$set : {nn_ids: nn}}) 21 Friday, December 3, 2010
  • 22. Facebook Friendʼs Events Two queries 1. Get FB friends db.users.find({fb._id : {$in : fb.friends}}) 2. Get events FB friends are attending db.events.find({_id : {$in : fb_friends_events}}) 22 Friday, December 3, 2010
  • 23. The Future • Incorporate other social networks • Iterate scoring algorithm • Count recommendation impressions 23 Friday, December 3, 2010
  • 24. Weʼre hiring! http://www.eventbrite.com/jobs/ 24 Friday, December 3, 2010
  • 25. Thanks! Brian Zambrano <brianz@eventbrite.com> Eventbriteʼs new Facebook recommendations power social event discovery: http://bit.ly/gRVS7I Social Commerce: A First Look at the Numbers: http://bit.ly/gXeg9Q 25 Friday, December 3, 2010