15
<SOCIAL NETWORK ARCHITECTURE> @DEV ZONE

Social network architecture - Part 2. News feed

Embed Size (px)

Citation preview

Page 1: Social network architecture - Part 2. News feed

<SOCIAL NETWORK ARCHITECTURE>@DEV ZONE

Page 2: Social network architecture - Part 2. News feed

Overview architecture

Web Apps

Web Service APIs

Mobile Apps

4. Front-end

SSOUser

ranking

1. Core User

User Data Storage

Real-time Notification

News Feed

2. User Activity System

User Activity Storage

3. Others

Real-time Chat

Search System Suggestion System

3. Big Data System

Big Data Storage

External Apps

Service Data

UserAdministrator

Page 3: Social network architecture - Part 2. News feed

Notification & Feed System –NFS (Need For Speed :D)

Page 4: Social network architecture - Part 2. News feed

2. NFS: Definition

• Notification: to owner

• News feed: to owner connection

Page 5: Social network architecture - Part 2. News feed

2. NFS: Process

STORAGE

Activities

Connections

AGGREGATION

Feed ItemsNotifications

DISPLAY

HTMLsJSONsAJAXs

Page 6: Social network architecture - Part 2. News feed

2. NFS: STORAGE

• Actions• Ronaldo followed Messi

• Ronaldo tagged Messi on a Post

Subject Verb Object Target

UserGroup

FollowAdd (friend, member)JoinPostLikeShareCommentTagUpdate

UserGroupContent

UserGroupContent

Page 7: Social network architecture - Part 2. News feed

2. NFS: STORAGE

• Connections• Ronaldo follow Messi

• Ronaldo post a Content

• Ronaldo comment a Content

• Ronaldo join a Group

• …

Content

Group

User

User

post, follow, tag, comment

Page 8: Social network architecture - Part 2. News feed

2. NFS: STORAGE

• Store actions -> activities• [owner, [{ subject, verb, object, target }]]

• Examples:• Ronaldo followed Messi

• [ Ronaldo, [{ Ronaldo, follow, Messi, null }]]• Ronaldo added friend to Messi

• [ Ronaldo, [{ Ronaldo, friend, Messi, null }]]• [Messi, [{ Ronaldo, friend, Messi, null }]]

• Ronaldo post Content on a Group• [ Ronaldo, [{ Ronaldo, post, Content, Group }]]• [Content, [{ Ronaldo, post, Content, Group }]]• [ Group, [{ Ronaldo, post, Content, Group }]]

• Ronaldo tagged Messi on a Post• [ Ronaldo, [{ Ronaldo, tag, Messi, Post }]]• [ Messi, [{ Ronaldo, tag, Messi, Post }]]• [ Post, [{ Ronaldo, tag, Messi, Post }]]

Page 9: Social network architecture - Part 2. News feed

2. NFS: STORAGE

• Store Connections

• Model• [from, to, weight]

from to weight

A B 0.1

A C 0.2

C A 0.3

Page 10: Social network architecture - Part 2. News feed

2. NFS: AGGREGATION

• News feed Plans• Pull: generate feed item for requested user as soon as he|she request

• Push: generate feed item for connected users as soon as a user action

• Pull & Push• Active user push

• Other pull

• Schedule: generate feed item for connected user

Page 11: Social network architecture - Part 2. News feed

2. NFS: AGGREGATION

• Steps1. Iterate Activities

2. Select Connections

3. Generate Feed items

Focus Push plan

Page 12: Social network architecture - Part 2. News feed

2. NFS: AGGREGATION

• Select connections• Activities: Ronaldo post Content on a Group

• Connections

owner subject verb object target

Ronaldo Ronaldo Post Content Group

Group Ronaldo Post Content Group

from to weight

Neymar Ronaldo 0.5

Kaka Ronaldo 0.5

Suarez Messi 0.8

Kaka Group 0.5

• Generate Feed items• Feed items

owner order SVO VOT Data

Neymar 1.1 RPC PCG {}

Kaka 1.2 RPC PCG {}

Kaka 1.5 RPC PCG {}

Page 13: Social network architecture - Part 2. News feed

2. NFS: AGGREGATION

• Feed items

1.1

Feed item

0x0001

0x0002

1.2

Feed item

0x0001(RPC)

0x101(PCG)

1.5

Feed item

0x0001(RPC)

0x101(PCG)

Page 14: Social network architecture - Part 2. News feed

2. NFS: DISPLAY

• Front-ends• Web: HTML, JSON, AJAX

• Mobile: HTML, JSON, XML

• API: JSON

Page 15: Social network architecture - Part 2. News feed

2. NFS: DISPLAY

• Group• Example: Ronaldo and Messi commented on Content

• Get relation contents

• Generate HTML, JSON

1.2

Feed item

0x0011

0x101

1.5

Feed item

0x0001

0x101