MapReduce: Detailed Design
Learn about the detailed working of our MapReduce system.
Let’s discuss the MapReduce design in detail, including estimations and the detailed role of all the components—their internal mechanisms and the execution flow.
Estimations
In our design, we’ll have to specify the number of workers required to achieve the task based on the input file size. Let’s make some assumptions before we formulate the workers’ calculations.
Assumptions
- The input file size is (we assume this data size to simplify our calculations, as we will see shortly.)
- We will distribute the input data into splits of roughly to (we use multiples of 16 MB because the underlying storage of GFS’s chunk size is 64 MB, and we want to maximize data locality benefits).
- We can distinguish the tasks into two categories based on their executing functions—
Map
andReduce
. - All workers are identical in their memory and computation resources.
- There are no malfunctioning workers.
Note: In this chapter, we’ll refer to workers as machines. Even though our design automatically handles the differences in workers’ memories and computation resources and the cases of faultiness, these calculations remain independent of these points.
Estimating the Map
tasks (M)
We can estimate the number of Map
tasks required using the following formula:
Using the file size under the assumptions section, we can estimate the number of Map
tasks:
Workers estimation
Based on the number of Map
tasks (M), we can estimate the number of workers (W) as well, making each worker perform Map
tasks.
Using the number from the previous calculation for Map
tasks, this estimation is as follows:
Estimating the Reduce
tasks (R)
Mainly, the number of Reduce
tasks (R) are user-defined as each task produces its separate output file. We usually estimate this number as a small multiple of the available workers in the cluster, as an example.
Based on the number of workers above, we can estimate R as follows:
You may change the input file size in the following calculator widget to see how it impacts M, worker count, and the R values.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.