Chapter 10 checkpoint: Twitter timeline and search
Every question from this chapter’s lessons. Your first answer to each is the one that counts; afterward you can practice again as often as you like. Passing needs 75% right on the first attempt.
0 of 17 answered0 right on the first attempt
Question 1 of 17
Users post 500 million tweets a day, and each is delivered to 10 followers on average. About how many deliveries per second is that?
deliveries/s
Answers within 5% count.
Question 2 of 17
Each home-timeline entry is 17 bytes. Keeping 800 entries for each of 100 million active users, how much RAM is that before replication, in TB?
Answers within 5% count, in any unit you choose.
Question 3 of 17
Twitter replicated each timeline entry on 3 machines. How much RAM does the 1.36 TB of timelines need once replicated, in TB?
Answers within 5% count, in any unit you choose.
Question 4 of 17
Tweets average 10 KB including media, and 500 million arrive each day. How much new content accumulates in 3 years, in PB?
Answers within 5% count, in any unit you choose.
Question 5 of 17
What is the main trade-off between fan-out on write (push) and fan-out on read (pull)?
Question 6 of 17
How does the hybrid design deal with accounts that have millions of followers?
Question 7 of 17
Followers of a celebrity sometimes see a reply to the celebrity’s tweet before the tweet itself. Why, and what mitigates it?
Question 8 of 17
Match each timeline strategy to the work it does.
Question 9 of 17
A user returns after 40 days away, and the cache holds timelines only for users active in the last 30 days. What does the primer do?
Question 10 of 17
Snowflake gives each generator a 12-bit sequence per millisecond. At most how many IDs can one generator produce per second?
IDs/s
Answers within 1% count.
Question 11 of 17
How does Snowflake make IDs that are roughly time ordered without a central counter?
Question 12 of 17
You shard the tweet store by
user_id. What do you gain and what do you risk?Question 13 of 17
After an NTP correction moves a server’s clock back by two seconds, its Snowflake generator stops returning IDs for about two seconds. Why?
Question 14 of 17
Earlybird hash-partitions tweets across its servers. Why must each search query go to every server?
Question 15 of 17
Put the steps of the primer’s search request in order.
- Send the query to every server in the search cluster
- Parse and tokenize the query, normalizing terms
- Return the results to the user
- Each server returns its best matches
- Merge, rank and sort the results
Question 16 of 17
The posting list for “raft” is
[1042, 1089, 2104], and for “consensus” it is [1042, 1520, 2104]. Which documents match raft AND consensus?Question 17 of 17
Each of 8 shards returns its top 10 matches, and the front end merges them. Assume a document scores the same whichever shard holds it. Is the merged top 10 the same as searching one big index would give?