Real Time Comments on Facebook

System DesignReal-time & ChatRecommendation & Feed

Materials — open to everyone, no sign-in

Topic: Real Time Comments on Facebook

Interviewer: ken

Level: L6 (Staff)

Additional Resources:


System Design Interview - Real Time Comments

12/4/2024

YouTube for the event:

Coach Ken LinkedIn:

https://commitway.com/linkedin

WeChat QRCodes

| | | 职场提升俱乐部 |

Interview

[45]

[40:10]

[35]

[31]

Design

[26:38]

[19:37]

Return comments within 30 seconds of submission

Websockets may be a better choice because too much load from pulling

Shard the user so they always connect to a specific comment service

[18:13]

Can consider putting comments into memory

Shard comment server by post

[15:49]

[13:42]

All users in the region connect to one server

PostID, list of strings

Server contains comments for the past day

[11:45]

Serving all interesting posts

Pre-load

[07:30]

One server for all comment text

Calculate size

[6]

1 server is insufficient to accommodate the size of the comments of the day

Post ID may not work

Shard by ? to put comments into different servers

Determine which posts to the users

[3:24]

Load top commented posts

Shard based on post

Other posts with one comment

Does the user jump from server to server when scrolling down

===

Interviewee

Performance not ideal

In preparation, focused more on stateless server

Was not fast enough during deep dive