title: Yarn : Automatic clearing of filecache & usercache
body: <p>We are running a spark streaming job with yarn as resource manager, noticing that these two directories are getting filled up on the data nodes and we are running out of space when we only run for couple of min's</p>
  
  <p>/tmp/hadoop/data/nm-local-dir/filecache</p>
  
  <p>/tmp/hadoop/data/nm-local-dir/filecache</p>
  
  <p>these directories are not getting cleared automatically , from my research found that this property need's to be set,  <strong>yarn.nodemanager.localizer.cache.cleanup.interval-ms</strong></p>
  
  <p>Even after setting this up ..it's not automatically clearing out any help will be greatly appreciated </p>
  
  <pre><code>&lt;configuration&gt;
      ~
      ~   &lt;property&gt;
      ~       &lt;name&gt;yarn.nodemanager.aux-services&lt;/name&gt;
      ~       &lt;value&gt;mapreduce_shuffle&lt;/value&gt;
      ~   &lt;/property&gt;
      ~
      ~   &lt;property&gt;
      ~       &lt;name&gt;yarn.resourcemanager.hostname&lt;/name&gt;
      ~       &lt;value&gt;hdfs-name-node&lt;/value&gt;
      ~   &lt;/property&gt;
      ~
      ~   &lt;property&gt;
      ~       &lt;name&gt;yarn.nodemanager.resource.memory-mb&lt;/name&gt;
      ~       &lt;value&gt;16384&lt;/value&gt;
      ~   &lt;/property&gt;
      ~
      ~   &lt;property&gt;
      ~       &lt;name&gt;yarn.nodemanager.resource.cpu-vcores&lt;/name&gt;
      ~       &lt;value&gt;6&lt;/value&gt;
      ~   &lt;/property&gt;
      ~
      ~   &lt;property&gt;
      ~       &lt;name&gt;yarn.scheduler.maximum-allocation-mb&lt;/name&gt;
      ~       &lt;value&gt;16384&lt;/value&gt;
      ~   &lt;/property&gt;
           &lt;property&gt;
      ~       &lt;name&gt;yarn.nodemanager.localizer.cache.cleanup.interval-ms&lt;/name&gt;
      ~       &lt;value&gt;3000&lt;/value&gt;
      ~   &lt;/property&gt;
      ~
      ~   &lt;!-- Needs to be explicitly set as part of a workaround for YARN-367.
      ~      | If changing this property, you must also change the
      ~      | hadoop.tmp.dir property in hdfs-site.xml. This location must always
      ~      | be a subdirectory of the location specified in hadoop.tmp.dir. This
      ~      | affects all versions of Yarn 2.0.0 through 2.7.3+. --&gt;
      ~   &lt;property&gt;
      ~       &lt;name&gt;yarn.nodemanager.local-dirs&lt;/name&gt;
      ~       &lt;value&gt;file:///tmp/hadoop/data/nm-local-dir&lt;/value&gt;
      ~   &lt;/property&gt;
      ~
      ~ &lt;/configuration&gt;
  </code></pre>