Tuesday, November 18, 2014

The Way To Set Global Java Opts In Hadoop Without Being Overlapped At Runtime

I intend to set the default java GC collector to '-XX:+UseSerialGC' for all YARN applications without being overlapped at runtime.

After setting it to parameter 'mapreduce.map.java.opts' in mapred-site.xml as below and synchronizing it to all nodes, it will be overlapped when configuring the same parameter at runtime, for instance: `hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.2.0.jar pi -Dmapreduce.map.java.opts="-Xmx256M" 4 1000`.
//mapred-site.xml
<property>
    <name>mapreduce.map.java.opts</name>
    <value>-Xmx1024M  -XX:+UseSerialGC</value>
</property>

There are two commands we can issue on a DataNode to check out whether the parameter '-XX:+UseSerialGC' takes into effect or not. Whichever command we are using, we should only focus on 'YarnChild' processes.
//--#1--
/usr/java/jdk1.7.0_11/bin/jps  -mlv  |  grep  -i  gc  
//--#2--
/usr/java/jdk1.7.0_11/bin/jps  |  awk  '{if($2=="YarnChild")  print  $1}'  |  xargs  /usr/java/jdk1.7.0_11/bin/jinfo  |  grep  -i  gc'

Then I tried to configure it in hadoop-env.sh, neither 'HADOOP_OPTS' nor 'HADOOP_CLIENT_OPTS' did it work:
//hadoop-env.sh
export  HADOOP_OPTS="$HADOOP_OPTS  -Dmapreduce.map.java.opts='-XX:+UseSerialGC'"
export  HADOOP_CLIENT_OPTS="-XX:+UseSerialGC  $HADOOP_CLIENT_OPTS"

Finally, I found a parameter which is not described in the official document of mapred-default.xml: 'mapreduce.admin.map.child.java.opts' (The corresponding one to reduce is 'mapreduce.admin.reduce.child.java.opts'). After setting this parameter in mapred-site.xml and synchronizing the file to all nodes, it works fine and definitely will not be overrided since we merely override parameter 'mapreduce.map.java.opts' at runtime.
//mapred-site.xml
<property>
    <name>mapreduce.admin.map.child.java.opts</name>
    <value>-XX:+UseSerialGC</value>
</property>

Consequencely, when we'are going to set some global java opts, we can set them in 'mapreduce.admin.map.child.java.opts' and 'mapreduce.admin.reduce.child.java.opts' in mapred-site.xml.



References:
  1. Chapter 3. Setting Up the Hadoop Configuration - Hortonworks Data Platform


© 2014-2017 jason4zhu.blogspot.com All Rights Reserved 
If transfering, please annotate the origin: Jason4Zhu

22 comments:

  1. Good Post, I am a big believer in posting comments on sites to let the blog writers know that they ve added something advantageous to the world wide web.
    Click here:
    Microsoft azure training in rajajinagar
    Click here:
    Microsoft azure training in marathahalli

    ReplyDelete
  2. I have visited this blog first time and i got a lot of informative data from here which is quiet helpful for me indeed. 
    Click here:
    angularjs training in bangalore
    Click here:
    angularjs training in chennai
    Click here:
    angularjs training in velarchery

    ReplyDelete
  3. Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up. 

    Blueprism training in annanagar

    Blueprism training in velachery

    Blueprism training in marathahalli


    AWS Training in chennai

    AWS Training in bangalore

    ReplyDelete
  4. Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
    java training in chennai | java training in USA

    ReplyDelete
  5. Really you have done great job,There are may person searching about that now they will find enough resources by your post

    informatica mdm online training

    apache spark online training

    apache spark online training

    devops online training

    aws online training

    ReplyDelete
  6. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    Microsoft Azure online training
    Selenium online training
    Java online training
    Python online training
    uipath online training

    ReplyDelete
  7. Hello, I read your blog occasionally, and I own a similar one, and I was just wondering if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can advise? I get so much lately it’s driving me insane, so any assistance is very much appreciated.
    Data science Course Training in Chennai |Best Data Science Training Institute in Chennai
    AWS Course Training in Chennai |Best AWS Training Institute in Chennai
    Devops Course Training in Chennai |Best Devops Training Institute in Chennai
    Selenium Course Training in Chennai |Best Selenium Training Institute in Chennai

    ReplyDelete
  8. your post is easy to understand on coding. learn on azure through azure training in hyderabad to become a developer on microsoft azure

    ReplyDelete

  9. It’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read.
    Machine Learning Training in Chennai |Machine Learning Training Institute in Chennai

    ReplyDelete