Distributed Data Processing Flashcards
6 cards from real Data Engineering practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Distributed Data Processing flashcards as text
A financial services company needs to process massive volumes of transactional data. The highest priority is to ensure that all nodes in the distributed system have the same data at the same time to prevent inconsistencies like double-spending. During a network partition, which two characteristics should their distributed database prioritize according to the CAP theorem?
Answer: Consistency and Partition Tolerance
The CAP theorem states a distributed system can only guarantee two of the following three: Consistency, Availability, and Partition Tolerance. In the event of a network partition (P), a choice must be made between consistency (C) and availability (A). [3] Since the company's highest priority is ensuring all nodes have the same, most recent data to prevent financial errors, they must choose Consistency. As network failures are unavoidable in distributed systems, Partition Tolerance is a necessity. [5] Therefore, the system must prioritize Consistency and Partition Tolerance, potentially sacrificing Availability during a partition event. [4]
A data engineering team is designing a new analytics platform. They need to support both real-time fraud detection alerts and complex, end-of-day reporting that requires accurate, comprehensive historical data. Which data processing architecture is specifically designed to handle these dual requirements by combining batch and stream processing paths?
Answer: Lambda Architecture
Lambda architecture is a data-processing design that handles massive quantities of data by using both batch and stream-processing methods. [10] It consists of three layers: a batch layer for comprehensive views of historical data, a speed (or stream) layer for real-time views, and a serving layer that merges the outputs from both layers to respond to queries. [7, 12] This hybrid approach is ideal for use cases that require both low-latency, real-time analytics and accurate, batch-based reporting. [13]
When comparing Apache Spark and Hadoop MapReduce for a big data project, which of the following is a primary advantage of using Spark?
Answer: Superior performance for iterative algorithms and interactive queries.
Apache Spark's main advantage over Hadoop MapReduce is its superior performance, especially for iterative algorithms (like those in machine learning) and interactive data analysis. [9] This is because Spark processes data in-memory, using Resilient Distributed Datasets (RDDs), which avoids the significant disk I/O overhead inherent in MapReduce's multi-stage, disk-based approach. [11] While MapReduce can be more cost-effective for extremely large datasets due to its use of cheaper disk storage [17], Spark's speed is a decisive factor for many modern use cases. [16]
A data engineer is tasked with designing a partitioning strategy for a large, distributed user database. The most common query pattern is retrieving a user's complete profile using their `user_id`. To ensure an even distribution of data across nodes and prevent hotspots, which partitioning strategy would be most appropriate?
Answer: Hash Partitioning
Hash partitioning applies a hash function to the partition key (`user_id` in this case) to determine which partition the data belongs to. This strategy typically results in a uniform distribution of data across all partitions, which is ideal for preventing hotspots and distributing the query load evenly. [14] Range partitioning could lead to hotspots if, for example, new users are assigned sequential IDs. Vertical partitioning is not appropriate as the goal is to partition rows (user profiles), not columns.
Which of the following is a core mechanism for achieving fault tolerance in a distributed data processing system?
Answer: Data replication
Fault tolerance is the ability of a system to continue operating despite component failures. [21] A primary technique to achieve this is data replication, which involves storing multiple copies of data on different nodes or machines. [18] If one node holding a piece of data fails, the system can retrieve the data from another replica, ensuring availability and preventing data loss. [15]
A team is building a distributed system and has chosen a design that prioritizes Availability and Partition Tolerance (AP) from the CAP theorem. What is the most likely consequence for their system during a network partition?
Answer: The system may serve stale or outdated data.
According to the CAP theorem, a system that prioritizes Availability and Partition Tolerance (AP) must sacrifice some degree of Consistency during a network partition. [3] This means that to remain available, the system will continue to respond to requests even if it cannot guarantee that the data being returned is the most recent version. [6] Nodes on one side of the partition might not have received the latest updates from the other side, leading to the possibility of serving stale data. [5]