<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: The Wrath of DrWho, or Unpredictable Hadoop Memory Usage</title>
	<atom:link href="http://blog.rapleaf.com/dev/2010/01/05/the-wrath-of-drwho-or-unpredictable-hadoop-memory-usage/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rapleaf.com/dev/2010/01/05/the-wrath-of-drwho-or-unpredictable-hadoop-memory-usage/</link>
	<description>For engineers by engineers</description>
	<lastBuildDate>Mon, 30 Aug 2010 16:14:07 -0700</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Todd Lipcon</title>
		<link>http://blog.rapleaf.com/dev/2010/01/05/the-wrath-of-drwho-or-unpredictable-hadoop-memory-usage/comment-page-1/#comment-1475</link>
		<dc:creator>Todd Lipcon</dc:creator>
		<pubDate>Mon, 11 Jan 2010 04:47:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rapleaf.com/dev/?p=382#comment-1475</guid>
		<description>Here&#039;s a bit of further explanation (actually mostly copy-pasted from our response to Rapleaf&#039;s support ticket):

Since Hadoop uses fork and not vfork, it actually needs to make another copy of the memory space of your process. Fork uses copy-on-write, so it&#039;s still fairly efficient, but if the process that&#039;s forking has a large memory footprint, it can get ENOMEM if there isn&#039;t a ton of swap available. Basically, Linux will overcommit memory up to a certain configurable amount, but if the total vmem footprint of your processes exceeds a certain threshold, it will stop allowing it.

One way to confirm that this is the issue is to temporarily enable complete overcommitting of memory by tweaking /proc/sys/vm/overcommit_memory to the value 1 (&quot;always overcommit&quot;). I cannot recommend running with this setting - the default heuristic (value 0) is much safer.

Here are some short-term workarounds:

The first is to simply configure this node with a ton of swap space. This will figure into the memory overcommit calculations so that it won&#039;t return this error. Alternatively, you could fiddle with the value of /proc/sys/vm/overcommit_ratio - perhaps setting it to 100 or 200 instead of the default 50 would solve the issue.

The second workaround would be to force the UserGroupInformation to get cached earlier in your process, before you allocate large amounts of memory. You should be able to do this by calling UserGroupInformation.login(conf) at the top of your application.

Long term, this is an acknowledged bug/issue with Hadoop. http://issues.apache.org/jira/browse/HADOOP-4998 is the JIRA that will hopefully solve it - it proposes to implement a JNI library that will allow access to these unixy things without having to fork separate processes. Eli from Cloudera has started working on this ticket and we hope to include it in CDH once it&#039;s finished and committed.

-Todd from Cloudera</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a bit of further explanation (actually mostly copy-pasted from our response to Rapleaf&#8217;s support ticket):</p>
<p>Since Hadoop uses fork and not vfork, it actually needs to make another copy of the memory space of your process. Fork uses copy-on-write, so it&#8217;s still fairly efficient, but if the process that&#8217;s forking has a large memory footprint, it can get ENOMEM if there isn&#8217;t a ton of swap available. Basically, Linux will overcommit memory up to a certain configurable amount, but if the total vmem footprint of your processes exceeds a certain threshold, it will stop allowing it.</p>
<p>One way to confirm that this is the issue is to temporarily enable complete overcommitting of memory by tweaking /proc/sys/vm/overcommit_memory to the value 1 (&#8220;always overcommit&#8221;). I cannot recommend running with this setting &#8211; the default heuristic (value 0) is much safer.</p>
<p>Here are some short-term workarounds:</p>
<p>The first is to simply configure this node with a ton of swap space. This will figure into the memory overcommit calculations so that it won&#8217;t return this error. Alternatively, you could fiddle with the value of /proc/sys/vm/overcommit_ratio &#8211; perhaps setting it to 100 or 200 instead of the default 50 would solve the issue.</p>
<p>The second workaround would be to force the UserGroupInformation to get cached earlier in your process, before you allocate large amounts of memory. You should be able to do this by calling UserGroupInformation.login(conf) at the top of your application.</p>
<p>Long term, this is an acknowledged bug/issue with Hadoop. <a href="http://issues.apache.org/jira/browse/HADOOP-4998" rel="nofollow">http://issues.apache.org/jira/browse/HADOOP-4998</a> is the JIRA that will hopefully solve it &#8211; it proposes to implement a JNI library that will allow access to these unixy things without having to fork separate processes. Eli from Cloudera has started working on this ticket and we hope to include it in CDH once it&#8217;s finished and committed.</p>
<p>-Todd from Cloudera</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Glommen</title>
		<link>http://blog.rapleaf.com/dev/2010/01/05/the-wrath-of-drwho-or-unpredictable-hadoop-memory-usage/comment-page-1/#comment-1469</link>
		<dc:creator>Charles Glommen</dc:creator>
		<pubDate>Wed, 06 Jan 2010 23:54:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rapleaf.com/dev/?p=382#comment-1469</guid>
		<description>Ah, I see. I&#039;m not explicitly using copyToLocal, but have noticed that call in the stack trace when this occurs. It seems to occur when I provide tens of thousands of input files for a single map/reduce.</description>
		<content:encoded><![CDATA[<p>Ah, I see. I&#8217;m not explicitly using copyToLocal, but have noticed that call in the stack trace when this occurs. It seems to occur when I provide tens of thousands of input files for a single map/reduce.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bryan</title>
		<link>http://blog.rapleaf.com/dev/2010/01/05/the-wrath-of-drwho-or-unpredictable-hadoop-memory-usage/comment-page-1/#comment-1468</link>
		<dc:creator>bryan</dc:creator>
		<pubDate>Wed, 06 Jan 2010 23:40:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rapleaf.com/dev/?p=382#comment-1468</guid>
		<description>@Charles: Sadly, it&#039;s fairly application-specific. In our instance, we just made sure that we did all of our copyToLocal calls before we started doing the memory-intensive side of the application. This way, the shell calls happened before the JVM had accumulated a large heap size. I&#039;d recommend trying this, and if that won&#039;t work, you could consider not using copyToLocal (that is, streaming the files directly).</description>
		<content:encoded><![CDATA[<p>@Charles: Sadly, it&#8217;s fairly application-specific. In our instance, we just made sure that we did all of our copyToLocal calls before we started doing the memory-intensive side of the application. This way, the shell calls happened before the JVM had accumulated a large heap size. I&#8217;d recommend trying this, and if that won&#8217;t work, you could consider not using copyToLocal (that is, streaming the files directly).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Glommen</title>
		<link>http://blog.rapleaf.com/dev/2010/01/05/the-wrath-of-drwho-or-unpredictable-hadoop-memory-usage/comment-page-1/#comment-1467</link>
		<dc:creator>Charles Glommen</dc:creator>
		<pubDate>Wed, 06 Jan 2010 23:31:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rapleaf.com/dev/?p=382#comment-1467</guid>
		<description>I am experiencing a similar, if not identical, issue with the OutOfMemoryError. Can you provide more details into how you fixed this?</description>
		<content:encoded><![CDATA[<p>I am experiencing a similar, if not identical, issue with the OutOfMemoryError. Can you provide more details into how you fixed this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bryan</title>
		<link>http://blog.rapleaf.com/dev/2010/01/05/the-wrath-of-drwho-or-unpredictable-hadoop-memory-usage/comment-page-1/#comment-1465</link>
		<dc:creator>bryan</dc:creator>
		<pubDate>Wed, 06 Jan 2010 16:00:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rapleaf.com/dev/?p=382#comment-1465</guid>
		<description>@harish: it definitely should, and most of the time, it does. However, I think there are some oddities around what happens when you ask the OS for 2x the physical memory of the machine. There&#039;s this &quot;overcommit&quot; parameter that governs this behavior which I must admit to not fully understanding. Additionally, I have a suspicion that when there&#039;s a reasonable amount of concurrency,  the garbage collector could somehow interfere with copy on write.</description>
		<content:encoded><![CDATA[<p>@harish: it definitely should, and most of the time, it does. However, I think there are some oddities around what happens when you ask the OS for 2x the physical memory of the machine. There&#8217;s this &#8220;overcommit&#8221; parameter that governs this behavior which I must admit to not fully understanding. Additionally, I have a suspicion that when there&#8217;s a reasonable amount of concurrency,  the garbage collector could somehow interfere with copy on write.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harish Mallipeddi</title>
		<link>http://blog.rapleaf.com/dev/2010/01/05/the-wrath-of-drwho-or-unpredictable-hadoop-memory-usage/comment-page-1/#comment-1464</link>
		<dc:creator>Harish Mallipeddi</dc:creator>
		<pubDate>Wed, 06 Jan 2010 13:09:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rapleaf.com/dev/?p=382#comment-1464</guid>
		<description>This is interesting. Shouldn&#039;t copy-on-write semantics of fork() prevent this problem?</description>
		<content:encoded><![CDATA[<p>This is interesting. Shouldn&#8217;t copy-on-write semantics of fork() prevent this problem?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
