URL Shortener

  • -10

    preeti_khurana about 1 year ago

    Question: How many URLs will we need to handle in the next 5 years? 1
    Hint: Earlier we saw, we would see 100 Million new URLs each month. Assuming same growth rate for next 5 years, total URLs we will need to shorten will be 100 Million * 12 * 5 = 6 Billion.
    Answer: 6 Billion.

    reply
  • -6

    preeti_khurana about 1 year ago

    Question: How many URLs will we need to handle in the next 5 years? 1
    Hint: Earlier we saw, we would see 100 Million new URLs each month. Assuming same growth rate for next 5 years, total URLs we will need to shorten will be 100 Million * 12 * 5 = 6 Billion.
    Answer: 6 Billion.

    reply
  • 1

    agniswar_bakshi about 1 year ago

    Do the tiny urls need to have an expiry time ?

    reply
    • 1

      lokesh91ag 11 months ago

      yes

      reply
      • 0

        bugmenot about 2 months ago

        why should there be any expiry time?? any particular logic...

        reply
        • 0

          lokesh91ag about 2 months ago

          The simplest one is that the owner wants to set the expiry time or if there is no activity from past x months then we can automatically expire that URL.

          reply
  • 2

    gauravraval about 1 year ago

    QPS:100 million / month
    = 3 million / day (100m/30)
    = 125000/hour (3m/24)
    = 2083 / minute (125000/60)
    = 34 / second ( 2083/60) (for create)


    Retrieval:
    1billion / month (10write) = 340/second (10write)

    reply
  • 0

    shmallshtrong about 1 year ago

    isn't the index size of total 3TB <hash key, URL> data 36GB?

    reply
    • 0

      sumit_007 about 1 year ago

      I am also having the same doubt. We need to index only hashes (6 bytes each). And total size is 6 billion entries => 36GB data. I guess this can easily fit into a single machine of 72GB RAM.

      reply
    • 0

      Titan99 9 months ago

      If we have QPS of 400 (given in question), and expected QPS to stress server is 50 (say), then we need 400/50 = 8 machines atmax, and we need to save 3TB (For saving actual urls as values) + 36GB (for saving shortened urls as keys) data. So we need 8 machines of (3 TB + 36 GB) / 8 = 380 GB appox each.

      reply
  • 0

    kumar_pratyush 12 months ago

    1157.407407407407

    reply
  • -2

    deepak_singh_603 11 months ago

    Helpful read : https://techinterviewutils.blogspot.in/

    reply
  • 2

    qqldd 7 months ago

    x^62 > 610^9 should be 62^x > 610^9.

    reply
  • 0

    sindhusree_gajjela 4 months ago

    high availability of the system

    reply
  • 0

    sindhusree_gajjela 4 months ago

    new urls per month: 100 million

    reply
  • 0

    vedanshu_dahiya 4 months ago

    chzixcz

    reply
  • 1

    anand.ratn 4 months ago

    How to deal with duplicate url ? In this case system will generate a new show url for the same url.

    reply
  • -1

    divyapal_singh_yaduvanshi about 1 month ago

    Food for thoughts : If I want to design this system but I want it to be highly available (L or A are ok ok to me and nothing related to analytics ) then do I really need a DB ? As we are generating hash, what if we use some logic from bloom filter, create N hash function to minimize hash collision. If we get rid of Db totally then all we need to care about is QPS (Nothing to read or write just calculate and send)

    reply
  • 0

    piyush_rungta 27 days ago

    How do we handle concurrency ? 2 same URLs should have same tiny code and 2 different URL should not have same tiny code. What is the right mechanism to generate tiny URL in a distributed environment.

    reply
Click here to start solving coding interview questions