Changing Number Of Reducers - Big Data In Real World

Changing Number Of Reducers

Changing Number Of Mappers
August 9, 2015
Speculative Execution
August 16, 2015
Changing Number Of Mappers
August 9, 2015
Speculative Execution
August 16, 2015

Changing Number Of Reducers

In this blog post we saw how we can change the number of mappers in a MapReduce execution. In this post, we will see how we can change the number of reducers in a MapReduce execution.

Let’s say your MapReduce program requires 100 Mappers. Now imagine the output from all 100 Mappers are being sent to one reducer. This one reducer will become a bottleneck for the entire MapReduce execution because this Reducer now has to wait for all 100 Mappers to complete, copy the data from all the 100 Mappers, merge the output from all 100 Mappers and then move on to the actual reduce execution. This is no ideal so it is wise to distribute the work load at the reduce side as well just like we did for Mappers by increasing the number of reducers.

Ways To Change Number Of Reducers

Update the driver program and set the setNumReduceTasks  to the desired value on the job  object.

job.setNumReduceTasks(5);

There is also a better ways to change the number of reducers, which is by using the mapred.reduce.tasks  property. This is a better option because if you decide to increase or decrease the number of reducers later, you can do so with out changing the MapReduce program.

-D mapred.reduce.tasks=10

 Usage

hadoop jar /hirw-starterkit/mapreduce/stocks/MaxClosePrice-1.0.jar com.hirw.maxcloseprice.MaxClosePrice -D mapred.reduce.tasks=10 /user/hirw/input/stocks output/mapreduce/stocks

 

Big Data In Real World
Big Data In Real World
We are a group of Big Data engineers who are passionate about Big Data and related Big Data technologies. We have designed, developed, deployed and maintained Big Data applications ranging from batch to real time streaming big data platforms. We have seen a wide range of real world big data problems, implemented some innovative and complex (or simple, depending on how you look at it) solutions.

Comments are closed.

Changing Number Of Reducers
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.

Hadoop In Real World is now Big Data In Real World!

X