SlideShare a Scribd company logo
Building Scalable and
Personalized News Feed
“activity streams”
Eyal Ronel for Web Developers Community
https://www.meetup.com/Web-Developers-Community
Eyal Ronel
R&D Manager at
https://www.linkedin.com/in/eyalronel
https://github.com/EyalRonel
@eyalronel
http://www.slidernet.co
Overview
1. Getting familiar with the concepts of activity streams
2. Differentiating between feeds and “dashboards”
3. Understanding the challenges
4. Guidelines on how to build you own feed mechanism
News Feed
What is it?
Building Scalable and Personalized News Feed
Not A Feed…
Bank Leumi - iOS App
Not A Feed…
CNN.com latest Headlines Officialcharts.com top rated songs
Popular Feeds
Instagram
• Users can follow/unfollow other users
• A News feed (used to) consists of all
items submitted by users you’re
following
• Feed Items include images, videos and
ads
• Sorted chronologically
Twitter
• Users can follow/unfollow other users
• A News feed consists of all items
submitted by users you’re following
• Feed Items include textual tweets,
images, videos and ads
• Sorted chronologically
Facebook
• Users can friend/unfriend other users
• User can follow/unfollow other users
(new friends are followed by default)
• A News feed consists of selected
items submitted by users you’re
following (not only your friends)
• Feed Items include status updates,
images, videos, checkins, ads, etc
• Sorted by Relevancy(!)
+450
+5+3
Understanding the challenge
Understanding the challenge
+450
+5+3
Understanding the challenge
The challenge
• Main challenge (back end):

Aggregating all posts, from all “followed” users ,
into a single, unified display
• Paging a constantly updating list of items
• Displaying newly added feed items after initial
rendering
Can this work?
?
Lets try..
SELECT * FROM POSTS
WHERE user_id IN (<followerID1>,…<FollowerIdN>)
LIMIT 10
OFFSET 0
ORDERBY date
What if I’m following 1,000 users?
10,000 users? 100K users?
SELECT * FROM Following
WHERE user_id = “<My User ID>
LEFT JOIN Users
ON users.id = Following.user_id
Far from optimal, does not scale
Conclusions
• A Complicated / Resource consuming query is
more suitable for reports / dashboards
• A Feed is not a Dashboard
Data - Items share the same data
structure, usually from a single data
source 



Visual - Items are visually similar




Sorting - Items are usually presented in
an ordered list (by “Score” or Date)
A result of an “aggregation” query
(JOIN, GROUP, etc)
• Data - Items are “enveloped”,
and may contain different data
structures, from multiple sources
• Visual - Different Visual for
different feed items, depending
on their type
• Sorting - “Relevancy scoring”
• A result of a simple query!

…but how?
Dashboard Feed
NoSQL
• Replicate data
• Work hard on insert
• Use simple queries to fetch
Feed Terminology
Actor
Verb
Object ID
Fan out Feed ItemsAction Followers
Verb Feed
1
Relevancy
Scoring!
Feed Terminology
Actor - A user performing an action 

(status update, image post, other)
Verb - Unique value describing the action’s
type. 

for example: 1 = status update, 2 = image
Action - A record containing the actor’s id,
verb, object id and additional meta-data.

An action will be eventually become
multiple feed items
Feed Terminology
Fan out - The process of distributing a
single action to all followers. turning an
action to multiple items.
Followers - A list of users subscribed to
updates for a specific feed
Object ID - The object ID (database id) of
the entity the action is describing
* (A post about an image, is not the image itself)
Feed Terminology
Item - A single instance of, or reference to
an action inside a user’s feed
Feed - A list of items assigned/associated
with a specific actor (user)
Feed Data Flow
Action Feed items
People don’t follow people, 

feeds follow feeds
One last thing before we can start…
In many cases, a single user has 2 feeds:
• News feed - a private feed containing items from his/her friends.

Technically, a user’s news feed is following other public feeds 

(profiles/timeline feeds)
• Profile (timeline) - a public feed listing all action performed by the 

current user.A ‘profile’ is actually a feed where all items have the same 

actor 

(the feed’s owner)



Feeds follow Feeds
My private
news feed
Yaron’s

public feed
Noa’s

public feed/profile
Itai’s

public feed
Yaron’s

public feed
Eyal’s

public feed/profile
Itai’s

public feed
Noa’s private

news feed
Feed Actions
• Modifying fanned-out feed items editing a “fanned-
out” post
• Adding Likes
• Adding Shares
• Existing Pub/Sub mechanisms
• Using relational databases - why/why not?
DEMO

More Related Content

PDF
Context Aware Recommendations at Netflix
PDF
Making Netflix Machine Learning Algorithms Reliable
PDF
Deep Learning for Personalized Search and Recommender Systems
PDF
Contextualization at Netflix
PPTX
Reward Innovation for long-term member satisfaction
PPTX
Recommendation Modeling with Impression Data at Netflix
PDF
An introduction to Recommender Systems
PDF
Recent Trends in Personalization at Netflix
Context Aware Recommendations at Netflix
Making Netflix Machine Learning Algorithms Reliable
Deep Learning for Personalized Search and Recommender Systems
Contextualization at Netflix
Reward Innovation for long-term member satisfaction
Recommendation Modeling with Impression Data at Netflix
An introduction to Recommender Systems
Recent Trends in Personalization at Netflix

What's hot (20)

PPTX
Netflix talk at ML Platform meetup Sep 2019
PDF
Recommender Systems
PDF
Algorithmic Music Recommendations at Spotify
PDF
Time, Context and Causality in Recommender Systems
PDF
A Multi-Armed Bandit Framework For Recommendations at Netflix
PDF
Personalizing "The Netflix Experience" with Deep Learning
PDF
Deeper Things: How Netflix Leverages Deep Learning in Recommendations and Se...
PDF
Engagement, metrics and "recommenders"
PDF
Missing values in recommender models
PDF
Recap: Designing a more Efficient Estimator for Off-policy Evaluation in Band...
PPTX
Personalized Page Generation for Browsing Recommendations
PDF
Homepage Personalization at Spotify
PPT
Recommendation system
PDF
Fact Store at Scale for Netflix Recommendations with Nitin Sharma and Kedar S...
PPTX
Recommender systems: Content-based and collaborative filtering
PPTX
Neo4j - graph database for recommendations
PDF
Shallow and Deep Latent Models for Recommender System
PPTX
Recommender system
PDF
Recent Trends in Personalization at Netflix
PDF
Recent Trends in Personalization: A Netflix Perspective
Netflix talk at ML Platform meetup Sep 2019
Recommender Systems
Algorithmic Music Recommendations at Spotify
Time, Context and Causality in Recommender Systems
A Multi-Armed Bandit Framework For Recommendations at Netflix
Personalizing "The Netflix Experience" with Deep Learning
Deeper Things: How Netflix Leverages Deep Learning in Recommendations and Se...
Engagement, metrics and "recommenders"
Missing values in recommender models
Recap: Designing a more Efficient Estimator for Off-policy Evaluation in Band...
Personalized Page Generation for Browsing Recommendations
Homepage Personalization at Spotify
Recommendation system
Fact Store at Scale for Netflix Recommendations with Nitin Sharma and Kedar S...
Recommender systems: Content-based and collaborative filtering
Neo4j - graph database for recommendations
Shallow and Deep Latent Models for Recommender System
Recommender system
Recent Trends in Personalization at Netflix
Recent Trends in Personalization: A Netflix Perspective
Ad

Similar to Building Scalable and Personalized News Feed (20)

PPTX
UCIAD overview
PPTX
Social Architecture of SharePoint 2013 for Developers
PPTX
OpenSocial in Practice - presented at VIVO14
PDF
#mytweet via Instagram: Exploring User Behaviour Across Multiple Social Networks
PPT
Rssfeeds
PPT
OpenURL Linking: the Academic Library Experience
PDF
Mikkel Heisterberg - An introduction to developing for the Activity Stream
PPTX
An Introduction to Working With the Activity Stream
PPT
Whizle Pres
PDF
PDF
ECIR2017-Inferring User Interests for Passive Users on Twitter by Leveraging ...
PPT
Rss slides final
PDF
Citation and Research Objects: Toward Active Research Objects
PPTX
Data Transfer between Activities & Databases
PPTX
SFDC Social Applications
PDF
Citation and reproducibility in software
PPSX
Rss technology -a_tool_to_expedite_up-to-date_information_for_library_users -...
PPTX
Information Extraction from Text, presented @ Deloitte
UCIAD overview
Social Architecture of SharePoint 2013 for Developers
OpenSocial in Practice - presented at VIVO14
#mytweet via Instagram: Exploring User Behaviour Across Multiple Social Networks
Rssfeeds
OpenURL Linking: the Academic Library Experience
Mikkel Heisterberg - An introduction to developing for the Activity Stream
An Introduction to Working With the Activity Stream
Whizle Pres
ECIR2017-Inferring User Interests for Passive Users on Twitter by Leveraging ...
Rss slides final
Citation and Research Objects: Toward Active Research Objects
Data Transfer between Activities & Databases
SFDC Social Applications
Citation and reproducibility in software
Rss technology -a_tool_to_expedite_up-to-date_information_for_library_users -...
Information Extraction from Text, presented @ Deloitte
Ad

Recently uploaded (20)

PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
DOCX
573137875-Attendance-Management-System-original
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Artificial Intelligence
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Geodesy 1.pptx...............................................
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPT
Project quality management in manufacturing
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Construction Project Organization Group 2.pptx
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Fundamentals of safety and accident prevention -final (1).pptx
573137875-Attendance-Management-System-original
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Artificial Intelligence
III.4.1.2_The_Space_Environment.p pdffdf
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Internet of Things (IOT) - A guide to understanding
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
UNIT 4 Total Quality Management .pptx
CYBER-CRIMES AND SECURITY A guide to understanding
Foundation to blockchain - A guide to Blockchain Tech
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Embodied AI: Ushering in the Next Era of Intelligent Systems
Geodesy 1.pptx...............................................
Safety Seminar civil to be ensured for safe working.
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Project quality management in manufacturing
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Construction Project Organization Group 2.pptx

Building Scalable and Personalized News Feed

  • 1. Building Scalable and Personalized News Feed “activity streams” Eyal Ronel for Web Developers Community https://www.meetup.com/Web-Developers-Community
  • 2. Eyal Ronel R&D Manager at https://www.linkedin.com/in/eyalronel https://github.com/EyalRonel @eyalronel http://www.slidernet.co
  • 3. Overview 1. Getting familiar with the concepts of activity streams 2. Differentiating between feeds and “dashboards” 3. Understanding the challenges 4. Guidelines on how to build you own feed mechanism
  • 6. Not A Feed… Bank Leumi - iOS App
  • 7. Not A Feed… CNN.com latest Headlines Officialcharts.com top rated songs
  • 9. Instagram • Users can follow/unfollow other users • A News feed (used to) consists of all items submitted by users you’re following • Feed Items include images, videos and ads • Sorted chronologically
  • 10. Twitter • Users can follow/unfollow other users • A News feed consists of all items submitted by users you’re following • Feed Items include textual tweets, images, videos and ads • Sorted chronologically
  • 11. Facebook • Users can friend/unfriend other users • User can follow/unfollow other users (new friends are followed by default) • A News feed consists of selected items submitted by users you’re following (not only your friends) • Feed Items include status updates, images, videos, checkins, ads, etc • Sorted by Relevancy(!)
  • 15. The challenge • Main challenge (back end):
 Aggregating all posts, from all “followed” users , into a single, unified display • Paging a constantly updating list of items • Displaying newly added feed items after initial rendering
  • 17. Lets try.. SELECT * FROM POSTS WHERE user_id IN (<followerID1>,…<FollowerIdN>) LIMIT 10 OFFSET 0 ORDERBY date What if I’m following 1,000 users? 10,000 users? 100K users? SELECT * FROM Following WHERE user_id = “<My User ID> LEFT JOIN Users ON users.id = Following.user_id Far from optimal, does not scale
  • 18. Conclusions • A Complicated / Resource consuming query is more suitable for reports / dashboards • A Feed is not a Dashboard
  • 19. Data - Items share the same data structure, usually from a single data source 
 
 Visual - Items are visually similar 
 
 Sorting - Items are usually presented in an ordered list (by “Score” or Date) A result of an “aggregation” query (JOIN, GROUP, etc) • Data - Items are “enveloped”, and may contain different data structures, from multiple sources • Visual - Different Visual for different feed items, depending on their type • Sorting - “Relevancy scoring” • A result of a simple query!
 …but how? Dashboard Feed
  • 20. NoSQL • Replicate data • Work hard on insert • Use simple queries to fetch
  • 21. Feed Terminology Actor Verb Object ID Fan out Feed ItemsAction Followers Verb Feed 1 Relevancy Scoring!
  • 22. Feed Terminology Actor - A user performing an action 
 (status update, image post, other) Verb - Unique value describing the action’s type. 
 for example: 1 = status update, 2 = image Action - A record containing the actor’s id, verb, object id and additional meta-data.
 An action will be eventually become multiple feed items
  • 23. Feed Terminology Fan out - The process of distributing a single action to all followers. turning an action to multiple items. Followers - A list of users subscribed to updates for a specific feed Object ID - The object ID (database id) of the entity the action is describing * (A post about an image, is not the image itself)
  • 24. Feed Terminology Item - A single instance of, or reference to an action inside a user’s feed Feed - A list of items assigned/associated with a specific actor (user)
  • 25. Feed Data Flow Action Feed items
  • 26. People don’t follow people, 
 feeds follow feeds One last thing before we can start… In many cases, a single user has 2 feeds: • News feed - a private feed containing items from his/her friends.
 Technically, a user’s news feed is following other public feeds 
 (profiles/timeline feeds) • Profile (timeline) - a public feed listing all action performed by the 
 current user.A ‘profile’ is actually a feed where all items have the same 
 actor 
 (the feed’s owner)
 

  • 27. Feeds follow Feeds My private news feed Yaron’s
 public feed Noa’s
 public feed/profile Itai’s
 public feed Yaron’s
 public feed Eyal’s
 public feed/profile Itai’s
 public feed Noa’s private
 news feed
  • 28. Feed Actions • Modifying fanned-out feed items editing a “fanned- out” post • Adding Likes • Adding Shares • Existing Pub/Sub mechanisms • Using relational databases - why/why not?
  • 29. DEMO