Grokking the System Design Interview
Ask Author
Back to course home

0% completed

Vote For New Content
Sachin Puranik
Memory estimates: Calculation -

Sachin Puranik

Feb 7, 2024

The calculation in documentation is based on how many users read in 24 hours. Shouldn't it be based on how many users actually create the new URL's instead. Do I have some different understanding?

Instead of -

20K * 3600 seconds * 24 hours = ~1.7 billion

0.2 * 1.7 billion * 500 bytes = ~170GB

should it be -

~200 * 3600 seconds * 24 hours = 17.28 Million

0.2 * 17.28 * 500bytes = Approx 1.7 GB.

Ultimately - we have only 17.28 new URL created in 24 hours.

1

0

Comments
Comments
R
Reno 2 years ago

This is for the cache which will be serving read traffic. The most popular URLs today could be the URLs created last week - we wouldn't gain anything from caching today's written data in that case, but would see performance improvement from caching today's read traffic.

Robert Chen
Robert Chena year ago

Hi @Sachin Puranik, I have the same thought too. It seems to me that memory calculation should be "write request (QPS)" times "Cache-Expiration-Time (TTL)" since the cached data are from written/created data. Let's say the cached data can stay in cache 10 days only, the...

On this page

  1. Why do we need URL shortening?

Try it yourself

Designing URL Shortener (video)

  1. Requirements and Goals of the System
  1. Capacity Estimation and Constraints
  1. System Interface Definition
  1. Create Short URL API
  1. Redirect API
  1. Analytics API
  1. URL Management API
  1. Delete Short URL API
  1. Database Design
  1. Basic System Design and Algorithm

a. Encoding actual URL

b. Generating keys offline

  1. Data Partitioning and Replication
  1. Cache
  1. Load Balancer (LB)
  1. Purging or DB cleanup
  1. Telemetry
  1. Security and Permissions