educative.io

Memory estimation for cache is computed with the number of redirection requests

as I see, redirection requests consist of some URL duplicated among the redirection. so It wouldn’t be the number of URLs in our database.

If what I think is right, we have to calculate the memory size with the number of shortening requests. because the number of shortening requests is stored in a database.

please, take a look at my opinion


Course: Grokking Modern System Design Interview for Engineers & Managers - Learn Interactively
Lesson: Requirements of TinyURL's Design

Hi Chanyong,

Your opinion is correct; the memory size required for the URL shortening service is primarily determined by the need to store the mapping between the generated short URLs and the original long URLs in the database. When a user visits a shortened URL, the service simply looks up this existing mapping to perform the redirection without storing any new data. While the number of redirection requests doesn’t directly impact memory size, it can affect other aspects of the system, such as processing power and throughput. Caching frequently accessed URLs improves performance.

Thank you,