Sharpen your distributed systems knowledge with key system design scenarios, testing your grasp on scaling, consistency, load balancing, and architectural decisions.
Which statement best describes the difference between horizontal and vertical scaling in distributed systems?
Explanation: Horizontal scaling adds more machines to the system, distributing the load, whereas vertical scaling enhances the resources of a single machine. The second option is incorrect because both scaling types can occur on-premises or in the cloud. The third confuses scaling with maintenance; scaling refers to system capacity, not software updates. The fourth misrepresents their impact; scaling does not inherently address latency or consistency in that manner.
What is the primary role of a load balancer in a distributed web application?
Explanation: A load balancer manages the distribution of incoming requests to multiple servers, improving reliability and performance. Encrypting data at rest is a security function, not performed by load balancers. Synchronizing databases is related to storage, not direct traffic management. Client-side caching is a separate optimization unrelated to load balancer responsibilities.
In the CAP theorem, which two properties can a distributed system guarantee during a network partition?
Explanation: Under network partition, only two properties can be guaranteed: Consistency and Partition Tolerance, or Availability and Partition Tolerance. The third property—availability or consistency—must be compromised. Latency, reliability, and throughput are not part of the CAP theorem, which specifically addresses consistency, availability, and partition tolerance.
In which scenario is eventual consistency more appropriate than strong consistency?
Explanation: Eventual consistency is suitable for scenarios like social media feeds where immediate consistency is not required. Funds transfer, real-time bidding, and stock management demand strong consistency to prevent errors or inconsistencies that can have real-world consequences.
What is a primary benefit of using an API Gateway in a microservices architecture?
Explanation: An API Gateway acts as a single entry point to microservices, handling cross-cutting concerns like authentication, rate limiting, and routing. It does not manage data storage, automate updates, or merge service codebases, but provides a central place for managing request flow and common logic.