This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What are some of the design issues in distributed systems? |
|
Answer» Following are some of the issues found in distributed systems:
|
|
| 2. |
How do you answer system design interview questions? |
Answer»
The primary objective of system design interviews is to evaluate how well a developer can plan, prioritize, evaluate various options to choose the best possible solution for a given problem. |
|
| 3. |
What do you understand by Leader Election? |
|
Answer» In a distributed environment where there are multiple servers contributing to the availability of the application, there can be situations where only one server has to TAKE LEAD for updating third party APIs as different servers could cause problems while using the third party APIs. This server is called the primary server and the process of choosing this server is called leader election. The servers in the distributed environment have to DETECT when the leader server has failed and appoint another one to BECOME a leader. This process is most SUITABLE in high availability and strong consistency based applications by using a consensus algorithm. |
|
| 4. |
What do you understand by Content delivery network? |
|
Answer» Content delivery network or in short CDN is a globally distributed proxy SERVER network that serves content from locations close by to the end-users. Usually, in websites, static files like HTML, CSS, JS files, images and videos are served from CDN. Using CDN in delivering content helps to IMPROVE performance:
There are two types of CDNs, they are:
|
|
| 5. |
What are the various Consistency patterns available in system design? |
|
Answer» Consistency from the CAP theorem states that every read request should get the most recently written data. When there are multiple data copies available, there arises a problem of synchronizing them so that the CLIENTS get fresh data consistently. Following are the consistency patterns available:
|
|
| 6. |
What is Caching? What are the various cache update strategies available in caching? |
|
Answer» Caching refers to the process of storing file copies in a temporary storage location called cache which helps in accessing data more quickly thereby reducing site latency. The cache can only store a limited amount of data. Due to this, it is important to determine cache update strategies that are best suited for the business requirements. Following are the various caching strategies available:
Cache-aside strategy is ALSO known as lazy loading because only the requested entry will be cached thereby avoiding unnecessary caching of the data. Some of the disadvantages of this strategy are:
The main disadvantage of this method is that there are chances of data loss if the cache goes down before the contents of the cache are written into the database.
This cache strategy results in reduced latency if it can predict accurately what items are NEEDED in future. |
|
| 7. |
How is performance and scalability related to each other? |
|
Answer» 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. |
|
| 8. |
How is sharding different from partitioning? |
||||||
Answer»
The following table lists the differences between sharding and partitioning:
|
|||||||
| 9. |
How is NoSQL database different from SQL databases? |
|||||||||||||||
Answer»
Check out more differences here. |
||||||||||||||||
| 10. |
What is Sharding? |
|
Answer» Sharding is a process of splitting the large logical dataset into multiple databases. It ALSO refers to HORIZONTAL partitioning of DATA as it will be stored on multiple machines. By doing so, a sharded database becomes capable of HANDLING more requests than a single large machine. Consider an example - in the following image, assume that we have around 1TB of data present in the database, when we perform sharding, we divide the large 1TB data into smaller chunks of 256GB into partitions called shards. Sharding HELPS to scale databases by helping to handle the increased load by providing increased throughput, storage capacity and ensuring high availability. |
|
| 11. |
What do you understand by Latency, throughput, and availability of a system? |
|
Answer» Performance is an important factor in SYSTEM design as it helps in making our services FAST and reliable. Following are the three key metrics for measuring the performance:
|
|
| 12. |
What do you understand by load balancing? Why is it important in system design? |
|
Answer» Load BALANCING refers to the concept of distributing incoming traffic efficiently ACROSS a group of various backend servers. These servers are called server pools. Modern-day websites are designed to serve millions of requests from clients and RETURN the RESPONSES in a fast and reliable manner. In order to serve these requests, the addition of more servers is required. In such a scenario, it is essential to distribute request traffic efficiently across each server so that they do not face undue loads. Load balancer acts as a traffic police cop facing the requests and routes them across the available servers in a way that not a single server is overwhelmed which could possibly degrade the application performance. When a server goes down, the load balancer redirects traffic to the remaining available servers. When a new server gets added to the configuration, the requests are automatically redirected to it. Following are the benefits of load balancers:
|
|
| 13. |
How is Horizontal scaling different from Vertical scaling? |
||||||||||||||||||
Answer»
This has been demonstrated in the image below: Horizontal scaling vs. Vertical scaling:
|
|||||||||||||||||||
| 14. |
What is CAP theorem? |
|
Answer» <P>CAP(Consistency-Availability-Partition Tolerance) theorem says that a distributed system cannot guarantee C, A and P simultaneously. It can at MAX provide any 2 of the 3 guarantees. Let us understand this with the HELP of a distributed database system.
The following image represents what databases guarantee what aspects of the CAP Theorem simultaneously. We see that RDBMS databases guarantee consistency and Availability simultaneously. Redis, MongoDB, Hbase databases guarantee Consistency and Partition Tolerance. Cassandra, CouchDB guarantees Availability and Partition Tolerance. Complete Video TUTORIAL. |
|