Facebook Interview Question for Software Engineer / Developers


Country: United States
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
2
of 2 vote

This is a good explanation, also is linked to a video where a facebook Engineer briefly explains how the newsfeed works in stack overflow: what-is-the-design-architecture-behind-facebooks-status-update-mechanism
Observer Pattern is very heavy for facebook since they have so many users. According to the video they cache the latest status updates for every user in their memcache server, and everytime a user wants to look at their news feed it hits those servers and get the top stories (+ more details)

- mina October 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Use Observer pattern for notifications. All friends are subscribed to one user's activity event. Each user is subscribed to it's activity update event (comment or like on its own activity).

- Anonymous September 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Cassandra would do it. As a matter of fact, check out this implementation of twitter in Cassandra.

github.com/twissandra/twissandra

- Anonymous June 20, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Scenario: user posts status, user receives news feed from friends

Service: news feed, friendship
When user posts status, write to db.
When user requests news feed, get the top 100 status from each friends, merge and return top 100

Storage:
status nosql row key user id, column key time stamp, value status
friend nosql row key user id, column key tie stamp, value friend id
disk = 1b dau * 0.5 post/day * 100byte = 50G/day

Scale
read qps = 1b * 5 read per day /86400 = 100k
peak = 200k, growth = 400k
write qps = 1b * 0.5/86400 = 10k
peak = 20k, growth = 40k
Turn on caching since qps is high.
memory = 1b*100*100byte = 10T.
So we need at least 100 100GB ram database server

- ly October 07, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More