Grokking the System Design Interview
Ask Author
Back to course home

0% completed

Vote For New Content
Vivek Patil
wrong line in MD5 hashing section?

Vivek Patil

Aug 13, 2024

We can take the first 6 (or 8) letters for the key. This could result in key duplication; to resolve that, we can choose some other characters out of the encoding string or swap some characters.

What are the different issues with our solution? We have the following couple of problems with our encoding scheme:

  1. If multiple users enter the same URL, they can get the same shortened URL, which is not acceptable.

Instead of 'same', shouldn't it be 'different' word in point 1? The point is irrespective of the user, any given long URL should always create a unique short URL. Am I missing something here?

0

0

Comments
Comments
H
htsondk251 7 days ago

Because you use hash as primary key, so, it cannot have 2 record with the same pk.

Imagine the case when 2 users want to shorten the same url (ex: website to get weather info), but the one who tries later cannot proceed. It make him confusing.

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