Scenario
Optimization can be performed when the number of CPU cores is large, for example, the number of CPU cores is three times the number of disks.
Procedure
You can set the following parameters in either of the following ways:
Table 1 Settings of multiple CPU cores
Configuration |
Parameter |
Configuration Description |
Number of slots in a node container |
yarn.nodemanager.resource.memory-mb
- Description: total physical memory that can be used by YARN on a node. The unit is MB.
- Default value:
Versions earlier than MRS 3.x:
8192
MRS 3.x or later:
16384
- Parameter configuration entry:
For versions earlier than MRS 3.x, configure this parameter on the MRS console.
For MRS 3.x or later: You need to configure this parameter on FusionInsight Manager.
|
- The parameter combination determines the number of concurrent tasks (Map and Reduce tasks) on each node.
- When multiple processes access the same disk simultaneously due to all Map/Reduce tasks requiring reading and writing data to a disk, it causes poor disk I/O performance. To ensure disk I/O performance, the number of concurrent access requests from a client to a disk cannot exceed 3.
- The maximum number of concurrent containers must be [2.5 x Number of disks configured in Hadoop].
|
mapreduce.map.memory.mb
- Description: memory limit of a Map task. The unit is MB.
- Default value: 4096
- Parameter configuration entry: You need to set this parameter in the configuration file on the client in the Client installation directory/HDFS/hadoop/etc/hadoop/mapred-site.xml path.
|
mapreduce.reduce.memory.mb
- Description: memory limit of a Reduce task. The unit is MB.
- Default value: 4096
- Parameter configuration entry: You need to set this parameter in the configuration file on the client in the Client installation directory/HDFS/hadoop/etc/hadoop/mapred-site.xml path.
|
Map output and compression |
mapreduce.map.output.compress
- Description: output of a Map task can be compressed before being transmitted over the network. It is a per-job configuration.
- Default value: true
- Parameter configuration entry: You need to set this parameter in the configuration file on the client in the Client installation directory/HDFS/hadoop/etc/hadoop/mapred-site.xml path.
|
- Compressing the Map task output before writing it to disks can provide benefits such as saving disk space, faster data write, and reduced data traffic delivered to the Reducer. You need to perform the configuration on the client.
- The disk I/O is the bottleneck. Therefore, use a compression algorithm with a high compression rate.
- Snappy is used. The benchmark test results show that Snappy delivers high performance and efficiency.
|
mapreduce.map.output.compress.codec
- Description: codec used for compression.
- Default value: org.apache.hadoop.io.compress.Lz4Codec
- Parameter configuration entry: You need to set this parameter in the configuration file on the client in the Client installation directory/HDFS/hadoop/etc/hadoop/mapred-site.xml path.
|
Spills |
mapreduce.map.sort.spill.percent
- Description: soft limit in the serialization buffer. Once this limit is reached, the thread will begin to overflow content to disk in the background.
- Default value: 0.8
- Parameter configuration entry: You need to set this parameter in the configuration file on the client in the Client installation directory/HDFS/hadoop/etc/hadoop/mapred-site.xml path.
|
Disk I/Os are the bottleneck. You can set the value of mapreduce.task.io.sort.mb to minimize the memory spilled to the disk. |
Data packet size |
dfs.client-write-packet-size
- Description: size of the data packet. It can be specified by each job.
- Default value: 262144
- Parameter configuration entry: You need to set this parameter in the configuration file on the client in the Client installation directory/HDFS/hadoop/etc/hadoop/hdfs-site.xml path.
|
- When the HDFS client writes data to a data node, the data will be accumulated until a packet is generated. The data packet is transmitted over the network.
- The data node receives data packets from the HDFS client and writes data into disks through single threads. When disks are in the concurrent write state, increasing the data packet size can reduce the disk seek time and improve the I/O performance.
- dfs.client-write-packet-size = 262144
|