Chapter 9 checkpoint: Pastebin and Bitly
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
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 of 17
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 of 17
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 of 17
A
POST creates a new paste. Which response does RFC 9110 make the standard for a newly created resource?Question 5 of 17
How many different 7-character Base62 keys are there, in trillions?
Answers within 2% count, in any unit you choose.
Question 6 of 17
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 of 17
You generate shortlinks by Base62-encoding an auto-increment counter. What is the main drawback for unlisted pastes?
Question 8 of 17
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 of 17
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?Question 10 of 17
Why does this design keep paste content in an object store such as S3 and only metadata in the database?
Question 11 of 17
A paste expired an hour ago, but the hourly sweeper has not run yet, and a user requests it. What should happen?
Question 12 of 17
Match each expiry mechanism to how it behaves.
Question 13 of 17
The sweeper must find expired pastes without scanning the whole table. What should the table store?
Question 14 of 17
A shortener must count every click and let owners change where a link points. Which redirect should it send?
Question 15 of 17
Match each redirect status to its behavior.
Question 16 of 17
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 of 17
Analytics must now be near real time. Where should the click event be published?