30 million * 5 years * 12 months = 1.8B 3. For this period the service will generate about 1.8 B records. Let’s assume we store every URL shortening request (and associated shortened link) for 5 years. Let’s assume our service has 30M new URL shortenings per month. Let’s start by making some assumptions about the traffic (for scalability) and the length of the URL. Shortened links should not be predictable.URL redirection should happen in real-time with minimal latency.This is really important to consider because if the service goes down, all the URL redirection will start failing. The system should be highly available.Links will expire after a standard default time span.When the user hits a short link, the service should redirect to the original link.Given a long URL, the service should generate a shorter and unique alias for it.This will clear the initial doubt, and you will get to know what specific detail the interviewer wants to consider in this service. Ask questions to identify the scope of the system. Requirementīefore you jump into the solution always clarify all the assumptions you’re making at the beginning of the interview. Let’s start by talking about the requirement first… 1. In this kind of question, the interviewer wants a high-level design idea where you can give the solution for the scalability and durability of the service. Most of the candidates make mistakes here and immediately they start listing out some bunch of tools, databases, and frameworks. When you’re asked this question in your interviews don’t jump into the technical details immediately. Is it really simple? Absolutely not if we think about the scalability of this service. When a user gives a long URL converts it into a short URL and updates the database and when the user hits the short URL then search the short URL in the database, get that long URL, and redirect the user to the original URL. A lot of candidates might be thinking that designing this service is not difficult.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |