Pastebin and Bitly
Every question from this chapter’s lessons, grouped by the lesson that teaches it. Answer each one right to finish; you can try again whenever you like.
0 of 17 answered right
9.1 Requirements, estimates and the API
0 of 4 answered rightQuestion 1
Using the primer’s rule of thumb of 2.5 million seconds in a month, how many paste reads per second does 100 million reads a month average out to?
reads/s
Answers within 5% count.
Question 2
Each paste takes about 1.27 KB (content plus its database row), and 10 million new pastes arrive each month. How much new data accumulates in 3 years, in GB?
Answers within 5% count, in any unit you choose.
Question 3
After 3 years there are 360 million shortlinks. You cache the most popular 20%, at about 500 bytes per cached entry. How much RAM is that, in GB?
Answers within 5% count, in any unit you choose.
Question 4
A
POST creates a new paste. Which response does RFC 9110 make the standard for a newly created resource?9.2 Short links: Base62, MD5 and a key service
0 of 5 answered rightQuestion 5
How many different 7-character Base62 keys are there, in trillions?
Answers within 2% count, in any unit you choose.
Question 6
With 360 million random 7-character Base62 keys already in use, a new random key collides with one of them about one time in how many?
tries
Answers within 5% count.
Question 7
You generate shortlinks by Base62-encoding an auto-increment counter. What is the main drawback for unlisted pastes?
Question 8
An application server takes a batch of keys from a key generation service and then crashes. What happens to the keys it had not used?
Question 9
Shortlinks are
base62(md5(ip_address + timestamp))[:7]. Two pastes from the same office, sent in the same second, keep getting the same shortlink. Why, and what fixes it?9.3 Storage: SQL or NoSQL, object storage and expiry
0 of 4 answered rightQuestion 10
Why does this design keep paste content in an object store such as S3 and only metadata in the database?
Question 11
A paste expired an hour ago, but the hourly sweeper has not run yet, and a user requests it. What should happen?
Question 12
Match each expiry mechanism to how it behaves.
Question 13
The sweeper must find expired pastes without scanning the whole table. What should the table store?
9.4 Redirects, caching and visit analytics
0 of 4 answered rightQuestion 14
A shortener must count every click and let owners change where a link points. Which redirect should it send?
Question 15
Match each redirect status to its behavior.
Question 16
Redirects are sent with
Cache-Control: public, max-age=60 behind a CDN. The click counts in your server logs are far lower than the CDN’s request counts. Why?Question 17
Analytics must now be near real time. Where should the click event be published?