Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java daemons launched with multiple -Xmx option (hadoop)

Tags:

java

hadoop

On a hadoop clusters that I am using, but do not have admin rights to, I see that the hadoop daemons for JobTracker, TaskTracker and DataNode are launched with the -Xmx options specified twice. Something like

/usr/java/default/bin/java -Dproc_datanode -Xmx1000m ... -Xmx128m ...

Now, in this case which option takes precedence? Is it the max of the two or the one that comes first or last?

This might not be specific to hadoop, just encountered it in this context so mentioning it.

like image 383
acharuva Avatar asked Feb 28 '14 12:02

acharuva


1 Answers

As suggested by @fge I tested this with a standalone java program, with the following main method

public static void main(String[] args){
    long mem = Runtime.getRuntime().maxMemory();
    System.out.println("Max mem="+mem/(1024*1024) + "m");       
}

and launched it with multiple -Xmx options, it seems to be picking up the last one. E.g.

java -Xmx100m -Xmx20m -Xmx400m The program output is Max mem=395m

like image 199
acharuva Avatar answered Sep 28 '22 03:09

acharuva