hadoop:when enble jvm reuse,several map or reduce tasks running parallelly in a single node share static data?
In another words: if I have a static String "xxx" in maper class, When enble jvm reuse,can 2 maps running parallelly in single node share the String "xxx" or There is still 2 static String "xxx" in separate maps.
Why do I have the confusion? cause I see the below comments:
Jobs can enable task JVMs to be reused by specifying the job configuration mapred.job.reuse.jvm.num.tasks. If the value is 1 (the default), then JVMs are not reused (i.e. 1 task per JVM). If it is -1, there is no limit to the number of tasks a JVM can run (of the same job). One can also specify some value greater than 1 using the api. share|edit|flag answered Feb 2 '11 at 18:09 Joe Stein 749169 1 Thanks, one more question. Does those tasks also share some Class-loader, so all statics resources will be loaded only once? (Or may it works like tomcat, in that way there are almost no reason to share JVM...) – yura Feb 4 '11 at 13:10 1
The JVM will be cleared after a task completes. This parameter only provides better runtime for jobs that are not "long-running" since the jvm instantiation is very expensive. You could not share any ressources over task instances. – Thomas Jungblut Feb 4 '11 at 21:04
above comments reference from: Is it possible to run several map task in one JVM?