URL Shortener Service
10 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the main advantage of using a URL shortener service, especially when sharing links through SMS or tweets?

The main advantage is that tiny URLs are exceedingly handy to share through SMS/tweets and printed materials, as they have less characters, which implies less printing cost and are easier to type.

What should you ask the interviewer when designing a URL shortener service?

You should ask the interviewer what features are expected in the service, which will then become the basis for functional requirements.

Can a customer create a custom tiny URL of their choice, and what is the maximum character limit for such URLs?

Yes, a customer can create a custom tiny URL of their choice, and the maximum character limit is 16.

What is assumed about the life span of a created URL in the system?

<p>It is assumed that once a URL is created, it will remain forever in the system.</p> Signup and view all the answers

What is the purpose of asking about the expected number of URL shortening requests per month?

<p>The purpose is to determine the scalability and capacity requirements of the URL shortener service.</p> Signup and view all the answers

What is the estimated number of unique shortened links generated per second, given 100 million new URL shortenings per month?

<p>~40 URLs/second</p> Signup and view all the answers

What is the estimated total storage requirement for the system, assuming a lifetime of 100 years and 100 million shortened links creation per month, with each data object being 500 bytes long?

<p>60TB</p> Signup and view all the answers

What percentage of requests are assumed to be cached, based on the Pareto Principle, and how much memory is required to cache these requests?

<p>20%, ~70GB</p> Signup and view all the answers

What is the purpose of returning an HTTP 302 Redirect instead of an HTTP 301 Redirect, in the context of URL redirection?

<p>To ensure all requests for redirection reach the backend and perform analytics.</p> Signup and view all the answers

What are the two functions that should be made accessible through the REST API, and what are the parameters required for these functions?

<p>The two functions are long_url and short_url. Parameters required are api_key, custom_url (optional), and long_url.</p> Signup and view all the answers

Study Notes

URL Shortener Service

  • A URL shortener service creates a short URL (alias/tiny URL) against a long URL.
  • When a user clicks on the tiny URL, they get redirected to the original URL.
  • Tiny URLs are useful for sharing through SMS/tweets (due to character limits) and printing in books/magazines (reducing printing cost).
  • They are also easier to type and less error-prone compared to longer URLs.

Features

  • Features of a URL shortener service may include:
    • Customizable tiny URL lengths
    • Expiration dates for tiny URLs
    • User-generated tiny URLs
    • Maximum character limit for custom URLs (e.g., 16 characters)
    • Metrics for most visited links
    • Analytics for targeted advertisements

System Design Goals

  • Functional requirements:
    • Non-functional requirements:
      • Performance
      • Scalability
      • Availability
      • Security

Traffic and System Capacity

  • Traffic assumptions:
    • 200:1 read/write ratio
    • 100 million new URL shortenings per month
    • 40 URLs/second generated
    • 8000 URLs/second redirected (with 200:1 read/write ratio)
  • Storage requirements:
    • 120 billion data points/objects (assuming 100 years of service)
    • 60TB of storage required (assuming 500 bytes per data object)
  • Memory requirements:
    • 70GB of memory required (caching 20% of 700 million requests per day)

High-Level Design

  • A rudimentary design for a URL shortener service includes:
    • Components for URL shortening, caching, and analytics
    • Limitations of the design (to be addressed later)

Algorithm and REST Endpoints

  • Two REST API functions:
    • long_url: A long URL to be shortened
    • api_key: A unique API key for user authentication and access control
    • custom_url (optional): A custom short link URL
  • Return values:
    • Short URL generated or error code (if invalid parameters)
  • Note: "HTTP 302 Redirect" status is used instead of "HTTP 301 Redirect" to ensure analytics tracking.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Learn about URL shortener services that create short aliases for long URLs, making it easy to share and type URLs, especially in character-limited platforms like SMS and tweets.

More Like This

URL Components Quiz
3 questions
Web Navigation Challenge
3 questions
URL Identification Quiz
3 questions

URL Identification Quiz

BrandNewAmethyst avatar
BrandNewAmethyst
URL Shortener Service Design
0 questions
Use Quizgecko on...
Browser
Browser