How Do You Design A Url Shortening Service Like Tinyurl Or Bitly
TinyURL or bit.ly takes a long URL and generates a new unique short URL. These systems are also capable of taking the shortened URL and returning the original full URL.
- What are some of the Required Features?
- Generate a short URL having a length shorter than the original URL.
- Store the original URL and map it to the shortened one.
- Allow redirects in the shortened URLs.
- Support custom names for short URLs.
- Handle multiple requests at the same time.
Use The Star Response Technique
Formatting your responses using the STAR interview response technique is a strategy to help you craft answers that illustrate your knowledge and qualifications through specific experiences. STAR is an acronym for Situation, Task, Action and Result. Using the STAR method, discuss an applicable situation, identify the task you needed to complete, outline the actions you took and reveal the results of your efforts to demonstrate your skills to the interviewer.
My Personal Background In System Design
In April 2008, I joined an internal team at Microsoft working on a large-scale project building a distributed storage solution.
Amazon had launched their Simple Storage Service in 2006, and Google launched their PaaS solution Google App Engine the same month I joined the team, so we were in the early land grab of cloud computing. Less than two years later, that project was launched to the world as a new product category: Microsoft Azure.
When I joined the Azure team, I came from working on Exchange. I understood server storage and client management, but not at this scale, and certainly not distributed across the world. It required a lot of learning on the job.
Today, the lessons myself and other cloud engineers learned in those early days are codified into the System Design discipline. Now for many companies, the System Design Interview is instrumental in the developer interview process which means it is vital for landing a job and setting your career on a good trajectory.
Note: at Educative we recently published our most comprehensive System Design resource yet: Grokking Modern System Design for Software Engineers & Managers. This course covers 13 of the most common system design interview questions and teaches you how to solve them through a modular building blocks approach. Its a great resource for any engineer hoping to level up their career.
Don’t Miss: How To Act In A Job Interview
What Is The Difference Between Clustered And A Non
A clustered index is a kind of index that you can use to change the order in which records are physically stored in a table. This is why tables can only have one such index.
A non clustered index is a kind of index in which the logical order of the index does not match the physical order of storing rows on a disk. The end node of such an index does not add up to the data site but consists of index rows.
Read Also: Employer Rejection Email After Interview
Common Backend Interview Questions And Answers
Let’s get started with some general backend questions and answers.
Recommended Reading: How To Answer Supervisor Interview Questions
Prep For The System Design Interview
In addition to coding interviews, system design is a required component of the technical interview process at many tech companies.
Practice common system design interview questions and compare your results with sample solutions: discussions, code, and diagrams.
Additional topics for interview prep:
Suggested topics to review based on your interview timeline .
Q: For interviews, do I need to know everything here?
A: No, you don’t need to know everything here to prepare for the interview.
What you are asked in an interview depends on variables such as:
- How much experience you have
- What your technical background is
- What positions you are interviewing for
- Which companies you are interviewing with
More experienced candidates are generally expected to know more about system design. Architects or team leads might be expected to know more than individual contributors. Top tech companies are likely to have one or more design interview rounds.
Start broad and go deeper in a few areas. It helps to know a little about various key system design topics. Adjust the following guide based on your timeline, experience, what positions you are interviewing for, and which companies you are interviewing with.
How Do You Design A Mass Social Media Platform
The aim of designing a mass social media platform such as Instagram, Facebook, and Twitter is to design a platform that enables its users to view a newsfeed with posts.
The basic features required by the social media service are stated below:
- Users can make public as well as private posts.
- The option of commenting and liking a post is available to the users.
- It should accommodate multiple users at once.
- There should be a newsfeed and recommendation system.
- Privacy controls are also to be taken care of.
- Trending posts/tweets are supposed to be visible.
The tools which are useful in the designing of the mass social media platform are as follows:
- To maximize the availability, rolling updates and replica nodes can be utilized.
- To recommend posts and news feeds, a trained machine learning algorithm can be used.
- A database schema can be created to store celebrities and some users separately.
- Some habits can be tracked using a social graph.
You May Like: How To Ace The Interview And Get The Job
What Are The Limitations Of Inheritance
Ans. Following are the limitations of inheritance:
- It is time-consuming because it needs to navigate through multiple classes for implementation.
- The child class and the base class are tightly packed, which makes it difficult to make changes.
- It is complex when it comes to implementation, which may result in errors if not implemented correctly.
Where Are The Answers
Sooner or later I will complete it with the relative answers. Feel free to contribute, it would be highly appreciated!
Law of Demeter
The Law of Demeter states that each unit should have only limited knowledge about other units and it should only talk to its immediate friends .Would you write code violating this principle, show why it is a bad design and then fix it?Resources
Active-Record is the design pattern that promotes objects to include functions such as Insert, Update, and Delete, and properties that correspond to the columns in some underlying database table. In your opinion and experience, which are the limits and pitfalls of the this pattern?Resources
Data-Mapper is a design pattern that promotes the use of a layer of Mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself. On the contrary, in Active-Record objects directly incorporate operations for persisting themselves to a database, and properties corresponding to the underlying database tables. Do you have an opinion on those patterns? When would you use one instead of the other?Resources
Billion Dollar Mistake
Why is it often said that the introduction of null is a billion dollar mistake? Would you discuss the techniques to avoid it, such as the Null Object Pattern introduced by the GOF book, or Option types?
Inheritance vs Composition
You May Like: Interview Questions For Nonprofit Executive Director
Read Also: What Do I Need For An Interview
System Design Interview Questions And Answers
System design questions are typically ambiguous to allow you the opportunity to demonstrate your qualifications. You can ask questions before you respond to help you narrow the scope, give you direction and clarify any expectations.
Here are six common questions you may be asked during your system design interview:
What Are The Essential Steps To Designing A Traffic Control System
You need to understand the basic principle of state transition, how to change the transition from one state to another. Since a traffic control system uses three colours to control traffic, lights colours change as per transitions. This point needs to be considered while designing. Besides, other mandatory system design constraints would also need to be followed. Check this video link to know more.
You May Like: What To Wear To A Job Interview Female
How Would You Design Netflix
To design a video streaming service like Netflix, the main idea to keep in focus is that Netflix should be able to store and transmit video data.
Basic features that are expected off of Netflix are listed down below:
- It should be able to upload videos on the internet.
- Uninterrupted video streaming should be available to the users.
- Other features such as comments and likes are also necessary.
- It should also support high traffic of multiple users.
Following tools help design Netflix:
- Cloud technology can be used for storing and transmitting video data.
- To recommend new video-related content, Machine Learning can be used.
Components in the designing of Netflix:
- OC Content Delivery Network
- Client Device to assess Netflix
Guidelines For High Level Designs
As you being to design solutions to use-cases its helpful to be constantly asking – what is the user trying to do here? to help frame your solution. Asking this helps prevent creating solutions to problems that arent relevant and helps you stay focussed on driving a solution forward that keeps things simple.
As you practice on real examples its good to keep things simple. No need to over-complicate things. The majority of times solutions wont be ground breaking new designs. A good enough solution is one where it solves the specific use-case in front of you, and you have analyzed its trade-offs and called out any potential limitations. This is much better than an over-engineered solution that attempts to solve everything at once.
It can be helpful to apply different lenses to look at the problem from different view points. Especially if you get stuck or not sure how to move things forward. Switching lenses can help you enumerate different potential solutions and considerations that apply to your solution.
The users viewpoint
Thinking in terms of how the user will actually use the system, and being able to visualize that, can help uncover edge cases and different user experiences you may need to take into consideration.
For example when navigating away from an infinite scrolling list, when the user comes back would they expect the scroll position to be in the same spot of the list when they went back?
The architects viewpoint
The maintainers viewpoint
Layer 7 Load Balancing
Layer 7 load balancers look at the application layer to decide how to distribute requests. This can involve contents of the header, message, and cookies. Layer 7 load balancers terminate network traffic, reads the message, makes a load-balancing decision, then opens a connection to the selected server. For example, a layer 7 load balancer can direct video traffic to servers that host videos while directing more sensitive user billing traffic to security-hardened servers.
At the cost of flexibility, layer 4 load balancing requires less time and computing resources than Layer 7, although the performance impact can be minimal on modern commodity hardware.
Design A Global Chat Service Like Whatsapp Or A Facebook Messenger
- What are some of the required features?
- Allow users to chat over the internet.
- Provide support for one-on-one and group chats.
- Messages need to be stored for better viewing.
- Messages need to be encrypted for security purposes.
You May Like: How To Prepare Yourself For An Interview
How Is Performance And Scalability Related To Each Other
A system is said to be scalable if there is increased performance is proportional to the resources added. Generally, performance increase in terms of scalability refers to serving more work units. But this can also mean being able to handle larger work units when datasets grow. If there is a performance problem in the application, then the system will be slow only for a single user. But if there is a scalability problem, then the system may be fast for a single user but it can get slow under heavy user load on the application.
What Do You Understand By Search Typeahead And How Can You Design It
Search Typeahead is a service that facilitates users to type some queries, and according to the query, it suggests top searched items starting with whatever the user has typed.
What type of questions the interviewer can discuss while you answer this question:
- What approach will you use to store previous search queries?
- What would be the real-time requirement of the system?
- What approach will you use to keep the data fresh?
- What approach will you use to find the best matches to the already typed string?
- What would you do to handle the queries per second by the system?
- What criteria will you set for choosing the suggestions?
- How would you store the total number of data queries?
- What approach would you use to find the best matches to the already typed string?
Don’t Miss: Edward Jones Boa Interview Questions
How Do You Design Youtube
Designing a YouTube is an interesting System design question as everyone is familiar with YouTube but a lot goes to design a video streaming service like YouTube. There are a lot of challenges related to storing data, indexing data, and providing streaming service.
Scalability is another major challenge as it needs to be fast and should be able to support millions of users. You can start designing YouTube on your own but if you stuck or need guidance you can see this free tutorial by Alex Xu from his popular System Design Interview Course on ByteByteGo.
Here is a nice flow diagram to explain video upload process:
Amazon System Design Interview Questions And Answers
If you have attempted a coding interview in the past, you must be aware that system design or software design problems are an important part of technical interviews. Practicing these questions is key to cracking tech interviews, especially if you’re gunning for senior positions.
Here are a couple of sample interview questions and the approach you should take to solve them:
Read Also: How Do You Solve Problems Interview Question
System Design Interview Questions With Answers
The following are the top 20 System Design interview questions you can prepare before your next Interview. These are pretty basic question and as a developer you should already be familiar with them but if not then make sure you practice before going for any system design interview.
Answer: System Design is a process of defining the elements of a system such as the modules, components, various interfaces and architecture. Interviewer ask System design questions to check technical knowledge of candidate. Its a great way to know whether candidate really understand how things work and computer and tech fundamentals, not just the buzz words like Scaling, High availability, Durability, Resiliency etc.
2. How do you design a web crawler? (solution]Answer: A web crawler service collects information/crawl from the entire internet and fetches millions of web documents. Things to keep in mind while designing a web crawler are:
- The approach is taken to find new web pages
- The approach to prioritize web pages that can change in a dynamic way
- To ensure that the web crawler service is bounded on the same domain
You can try solving the question but if you stuck, I recommend you to checkout Grokking the System Design Interview course on Educative, it provides a step by step solution to not just this question but also other System design question.
Here is a nice system design diagram for web crawler:
Design Uber Ola Or Lyft Type Of Systems
These platforms help user request rides and the driver picks them up from the location and drop them at the destination selected by the user.
- What are some of the required features?
- Real-time service for booking rides
- Should have the capability of assigning rides that lets the user reach the destination fast.
- Show the ETA of the driver after booking the ride and once the ride has been started, show the ETA of the vehicle arriving at the destination.
Also Check: Basic Accounting Test For Interview