SlideShare a Scribd company logo
1 of 17
NICETONODEYOU SOCIAL
NETWORK
MONGO LAB’S SOCIAL
DATA• Built in 5/14 on Java framework
• Proven able to support 10 million users
with minimum hardware scaling
• Aimed at providing a production capsule
reusable framework for social data
management
• Also tried to demonstrate best practices for
social data modeling, indexing and
querying in MongoDB
• Demonstrated how flexible a service
architecture coupled with MongoDB
sharding can create a scalable platform for
social data
HIGH LEVEL
ARCHITECTURE
EXPLODING CAT
WHY NODE?
• Node.JS shines in real-time web applications
• Push technology over web sockets
• Quick delivery
• Easier entry point than Java
USER GRAPH SERVICE
• Manages the users of the system and
more importantly the follower graph.
• Service must allow users to be added and
removed from the system and users to
“follow” the post of others.
• Service determines which user timelines
receive the posts by any given author (the
followers of that user)
• Must be carefully designed to scale to
significant read and write loads due to the
significant churn within the graph as users
elect to follow and unfollow users
SOCIALITE USER GRAPH
SCHEMA
NICETONODEYOU USER GRAPH
SCHEMA
CONTENT SERVICE• Dedicated to storing and retrieving raw content (posts)
generated by users.
• Serves as the system of record for all posts
• Stores the full post content indexed primarily by post id
• Allows content to be added by user and allocated a unique
id
• Perform basic validation on content
• Allow content to be found by id
• Allow content to be queried by user, anchor (a content id
that represents a point in time) and returned ordered by
time
SOCIALITE CONTENT
SCHEMA
LASER CAT
Sauna
FEED SERVICE
• Receive posts from a user
• Forwards the content of the post to the Content Service
• Serves timeline feeds for all users based on the posts of
accounts they follow
FEED SERVICE
• Fanout on Read
• Fanout on Write
One major design decision for a feed service is how and when to
assemble the timeline feed for users. The implementations each
fall into the two broad categories.
THE BAD - FANOUT ON
READ
• Simple implementation - almost pass
through to the content service
• Storage efficient - only stores a single
copy of message and it’s metadata
Advantages
• Multi-shard random IO - assembling
a feed will typically require reads that
span a number of shards. These
queries will involve a lot of random IO
and often read more data than is
necessary
• No caching - if two reads of the same
user’s timeline occurs in quick
succession, the entire query must be
re-processed irrespective of whether
the result will have changed.
• Large following lists - gathering the
timeline for a use with a large follower
list will be very expensive and at some
point would require splitting into
Disadvantages
THE BAD - FANOUT ON
READ
When to use
The Fanout on Read model is typically best suited for
• Timelines are viewed far less frequently than posts are
made
• Number of users and amount of content is smaller scale
and unsharded
• Users typically follow few people
• It is very common for older sections of the timeline to be
viewed
THE GOOD - FANOUT ON
WRITE
• Faster reads - having everything
already assembled reduces
Advantages
• Duplication - there is a lot of
duplication of the original message,
especially in highly connected
networks where the average user has
a lot of followers
• More complicated - this
implementation must use a
findAndModify command rather than
an upset to detect when a new
document needs to be created
Disadvantages
QUESTIONS?

More Related Content

Viewers also liked

Guia De Informática
Guia De InformáticaGuia De Informática
Guia De InformáticaMabelita1996
 
MORADORES DA RUA MAQUINISTA JOÃO MENDES SOFREM PELO DESCASO E DESRESPEITO DA ...
MORADORES DA RUA MAQUINISTA JOÃO MENDES SOFREM PELO DESCASO E DESRESPEITO DA ...MORADORES DA RUA MAQUINISTA JOÃO MENDES SOFREM PELO DESCASO E DESRESPEITO DA ...
MORADORES DA RUA MAQUINISTA JOÃO MENDES SOFREM PELO DESCASO E DESRESPEITO DA ...Antônio Fernandes
 
Lecture 8 mail security
Lecture 8 mail securityLecture 8 mail security
Lecture 8 mail securityrajakhurram
 

Viewers also liked (9)

Guia De Informática
Guia De InformáticaGuia De Informática
Guia De Informática
 
Stem Sel_FARETE 2016
Stem Sel_FARETE 2016Stem Sel_FARETE 2016
Stem Sel_FARETE 2016
 
MORADORES DA RUA MAQUINISTA JOÃO MENDES SOFREM PELO DESCASO E DESRESPEITO DA ...
MORADORES DA RUA MAQUINISTA JOÃO MENDES SOFREM PELO DESCASO E DESRESPEITO DA ...MORADORES DA RUA MAQUINISTA JOÃO MENDES SOFREM PELO DESCASO E DESRESPEITO DA ...
MORADORES DA RUA MAQUINISTA JOÃO MENDES SOFREM PELO DESCASO E DESRESPEITO DA ...
 
Mohamed Ismail
Mohamed IsmailMohamed Ismail
Mohamed Ismail
 
Newrosparks_Marco Guermandi
Newrosparks_Marco GuermandiNewrosparks_Marco Guermandi
Newrosparks_Marco Guermandi
 
Billetera movil
Billetera movilBilletera movil
Billetera movil
 
CV-James Klett
CV-James KlettCV-James Klett
CV-James Klett
 
Lecture 8 mail security
Lecture 8 mail securityLecture 8 mail security
Lecture 8 mail security
 
Pgp smime
Pgp smimePgp smime
Pgp smime
 

Similar to NicetoNodeYou

Microservices: The Right Way
Microservices: The Right WayMicroservices: The Right Way
Microservices: The Right WayDaniel Woods
 
Hia 1693-effective application-development_in_iib
Hia 1693-effective application-development_in_iibHia 1693-effective application-development_in_iib
Hia 1693-effective application-development_in_iibAndrew Coleman
 
Understanding Microservices
Understanding Microservices Understanding Microservices
Understanding Microservices M A Hossain Tonu
 
QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes Abdul Basit Munda
 
SOA (Service Oriented Architecture)
SOA (Service Oriented Architecture)SOA (Service Oriented Architecture)
SOA (Service Oriented Architecture)Annie Comp
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to MicroservicesMahmoudZidan41
 
Soa 22 software as a service and soa
Soa 22 software as a service and soaSoa 22 software as a service and soa
Soa 22 software as a service and soaVaibhav Khanna
 
Choosing the best JavaScript framework/library/toolkit
Choosing the best JavaScript framework/library/toolkitChoosing the best JavaScript framework/library/toolkit
Choosing the best JavaScript framework/library/toolkitHristo Chakarov
 
Community application design for streaming analytics
Community application design for streaming analyticsCommunity application design for streaming analytics
Community application design for streaming analyticsSandeep Kumar
 
Apache kafka- Onkar Kadam
Apache kafka- Onkar KadamApache kafka- Onkar Kadam
Apache kafka- Onkar KadamOnkar Kadam
 
Microservice Architecture Patterns, by Richard Langlois P. Eng.
Microservice Architecture Patterns, by Richard Langlois P. Eng.Microservice Architecture Patterns, by Richard Langlois P. Eng.
Microservice Architecture Patterns, by Richard Langlois P. Eng.Richard Langlois P. Eng.
 
Socialite, the Open Source Status Feed Part 1: Design Overview and Scaling fo...
Socialite, the Open Source Status Feed Part 1: Design Overview and Scaling fo...Socialite, the Open Source Status Feed Part 1: Design Overview and Scaling fo...
Socialite, the Open Source Status Feed Part 1: Design Overview and Scaling fo...MongoDB
 
MONGODB VASUDEV PRAJAPATI DOCUMENTBASE DATABASE
MONGODB VASUDEV PRAJAPATI DOCUMENTBASE DATABASEMONGODB VASUDEV PRAJAPATI DOCUMENTBASE DATABASE
MONGODB VASUDEV PRAJAPATI DOCUMENTBASE DATABASEvasustudy176
 
IBM InterConnect 2015 - IIB Effective Application Development
IBM InterConnect 2015 - IIB Effective Application DevelopmentIBM InterConnect 2015 - IIB Effective Application Development
IBM InterConnect 2015 - IIB Effective Application DevelopmentAndrew Coleman
 
Data warehouse and User interface
Data warehouse and User interface Data warehouse and User interface
Data warehouse and User interface RabiaIftikhar10
 
MICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMohammedShahid562503
 
MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.PLovababu
 
introduction to web engineering.pdf
introduction to web engineering.pdfintroduction to web engineering.pdf
introduction to web engineering.pdfNaglaaFathy42
 

Similar to NicetoNodeYou (20)

Microservices: The Right Way
Microservices: The Right WayMicroservices: The Right Way
Microservices: The Right Way
 
Hia 1693-effective application-development_in_iib
Hia 1693-effective application-development_in_iibHia 1693-effective application-development_in_iib
Hia 1693-effective application-development_in_iib
 
Understanding Microservices
Understanding Microservices Understanding Microservices
Understanding Microservices
 
QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes
 
SOA (Service Oriented Architecture)
SOA (Service Oriented Architecture)SOA (Service Oriented Architecture)
SOA (Service Oriented Architecture)
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Soa 22 software as a service and soa
Soa 22 software as a service and soaSoa 22 software as a service and soa
Soa 22 software as a service and soa
 
Choosing the best JavaScript framework/library/toolkit
Choosing the best JavaScript framework/library/toolkitChoosing the best JavaScript framework/library/toolkit
Choosing the best JavaScript framework/library/toolkit
 
Community application design for streaming analytics
Community application design for streaming analyticsCommunity application design for streaming analytics
Community application design for streaming analytics
 
Apache kafka- Onkar Kadam
Apache kafka- Onkar KadamApache kafka- Onkar Kadam
Apache kafka- Onkar Kadam
 
Microservice Architecture Patterns, by Richard Langlois P. Eng.
Microservice Architecture Patterns, by Richard Langlois P. Eng.Microservice Architecture Patterns, by Richard Langlois P. Eng.
Microservice Architecture Patterns, by Richard Langlois P. Eng.
 
Socialite, the Open Source Status Feed Part 1: Design Overview and Scaling fo...
Socialite, the Open Source Status Feed Part 1: Design Overview and Scaling fo...Socialite, the Open Source Status Feed Part 1: Design Overview and Scaling fo...
Socialite, the Open Source Status Feed Part 1: Design Overview and Scaling fo...
 
MONGODB VASUDEV PRAJAPATI DOCUMENTBASE DATABASE
MONGODB VASUDEV PRAJAPATI DOCUMENTBASE DATABASEMONGODB VASUDEV PRAJAPATI DOCUMENTBASE DATABASE
MONGODB VASUDEV PRAJAPATI DOCUMENTBASE DATABASE
 
Open access Jornal
Open access JornalOpen access Jornal
Open access Jornal
 
IBM InterConnect 2015 - IIB Effective Application Development
IBM InterConnect 2015 - IIB Effective Application DevelopmentIBM InterConnect 2015 - IIB Effective Application Development
IBM InterConnect 2015 - IIB Effective Application Development
 
Microservices-101
Microservices-101Microservices-101
Microservices-101
 
Data warehouse and User interface
Data warehouse and User interface Data warehouse and User interface
Data warehouse and User interface
 
MICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptx
 
MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.
 
introduction to web engineering.pdf
introduction to web engineering.pdfintroduction to web engineering.pdf
introduction to web engineering.pdf
 

Recently uploaded

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

NicetoNodeYou

  • 2. MONGO LAB’S SOCIAL DATA• Built in 5/14 on Java framework • Proven able to support 10 million users with minimum hardware scaling • Aimed at providing a production capsule reusable framework for social data management • Also tried to demonstrate best practices for social data modeling, indexing and querying in MongoDB • Demonstrated how flexible a service architecture coupled with MongoDB sharding can create a scalable platform for social data
  • 5. WHY NODE? • Node.JS shines in real-time web applications • Push technology over web sockets • Quick delivery • Easier entry point than Java
  • 6. USER GRAPH SERVICE • Manages the users of the system and more importantly the follower graph. • Service must allow users to be added and removed from the system and users to “follow” the post of others. • Service determines which user timelines receive the posts by any given author (the followers of that user) • Must be carefully designed to scale to significant read and write loads due to the significant churn within the graph as users elect to follow and unfollow users
  • 9. CONTENT SERVICE• Dedicated to storing and retrieving raw content (posts) generated by users. • Serves as the system of record for all posts • Stores the full post content indexed primarily by post id • Allows content to be added by user and allocated a unique id • Perform basic validation on content • Allow content to be found by id • Allow content to be queried by user, anchor (a content id that represents a point in time) and returned ordered by time
  • 12. FEED SERVICE • Receive posts from a user • Forwards the content of the post to the Content Service • Serves timeline feeds for all users based on the posts of accounts they follow
  • 13. FEED SERVICE • Fanout on Read • Fanout on Write One major design decision for a feed service is how and when to assemble the timeline feed for users. The implementations each fall into the two broad categories.
  • 14. THE BAD - FANOUT ON READ • Simple implementation - almost pass through to the content service • Storage efficient - only stores a single copy of message and it’s metadata Advantages • Multi-shard random IO - assembling a feed will typically require reads that span a number of shards. These queries will involve a lot of random IO and often read more data than is necessary • No caching - if two reads of the same user’s timeline occurs in quick succession, the entire query must be re-processed irrespective of whether the result will have changed. • Large following lists - gathering the timeline for a use with a large follower list will be very expensive and at some point would require splitting into Disadvantages
  • 15. THE BAD - FANOUT ON READ When to use The Fanout on Read model is typically best suited for • Timelines are viewed far less frequently than posts are made • Number of users and amount of content is smaller scale and unsharded • Users typically follow few people • It is very common for older sections of the timeline to be viewed
  • 16. THE GOOD - FANOUT ON WRITE • Faster reads - having everything already assembled reduces Advantages • Duplication - there is a lot of duplication of the original message, especially in highly connected networks where the average user has a lot of followers • More complicated - this implementation must use a findAndModify command rather than an upset to detect when a new document needs to be created Disadvantages