Optimization of mapreduce tasks in hadoop

Source: Internet
Author: User

1. Task Scheduling

(1) computing: hadoop will always give priority to assigning tasks to idle machines. All people can share system resources fairly.

(2) I/O: hadoop tries its best to allocate map tasks to the machine where input split is located to reduce network I/O consumption.

2. data preprocessing and input split size

(1) Before submitting a mapreduce task, you can perform a preprocessing of the data and merge the data to improve the execution efficiency of the mapreduce task. Refer to the execution time of map tasks. When the execution time of a map task is short, more data can be allocated. Set the input data size of map to adjust the running time of map.

3. Number of MAP and reduce tasks

(1) map task slots and reduce task slots. It refers to the maximum number of MAP/reduce tasks that the cluster can run simultaneously. The main reference for setting the map quantity of mapreduce tasks is the running time of map tasks, and the number of reduce tasks only needs to refer to the task slot settings.

4. Combine Functions

This is a function used to merge data locally. There is a lot of repeated data in the map. It is very time-consuming to transmit these records to reduce tasks one by one. Therefore, the mapreduce framework runs a combine function, used for local merge, which greatly reduces the consumption of network I/O operations. Job. setcombineclass (combine. Class );

5. When writing a mapreduce program, you can select to compress the map output and final output results (you can also select the compression mode ). In some cases, the intermediate output of map may be very large. compressing it can effectively reduce the amount of data transmitted over the network.

6. Custom compator

In hadoop, you can customize data types for more complex purposes. When you want to implement the K-means algorithm (a basic Clustering Algorithm), you can define a set of K integers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.