the number of containers.

Moving forward, the amount of data that passes through each stage is crucial to the accuracy of the model, therefore the data emitted by the map phase $M_d$ should also be calculated as shown in Equation . $d$ is the total input data for task $t$ and $M_{sel}$ is the map selectivity ratio $$M_d = d * M_{sel} 
\label{eq:mapsel}$$

### **Collect**

The output of each map task is not directly written to disk and consumed by the reducers. Instead, they are buffered and presorted in memory. This phase also depends on the amount of data emitted by the mappers. A linear cost model of the collect phase is given as below: $$T_{collect} = f(M_d) = \beta_{0c} + \beta_3M_d
\label{eq:collectphase}$$

### **Spill**

In this phase, map output data is partitioned, sorted in memory and written to local disks. Writing data to local disk is the main bottleneck. The more data to spill, the more time it will take. We can, therefore, represent the cost model using the linear relationship shown below: $$T_{spill} = f(M_d) = \beta_{0s} + \beta_4M_d
\label{eq:spillphase}$$

### **Merge**

Each time the collect buffer reaches its configurable threshold, a new spill file is created. Similar 