Configuring cache-aware scheduling

To enable a MapReduce job to retrieve its input split from the cache, set caching options in the MRSS definition file (mrss.xml). Once complete, submit a job, and then use the cluster management console to view the number of map tasks that retrieve their input splits from the cache.

Before you begin

For the most performance gains, configure cache-aware scheduling as follows:
  • Enable services to be pre-started through the preStartApplication element in the Consumer section of the application profile.
  • Configure PMR_MRSS_INPUTCACHE_MAX_MEMSIZE_MB to use all your free memory. To determine your total free memory, follow this formula:
    memory available 
    - memory used by SI 
    - memory used by DataNode 
    - memory used by intermediate data 
    = total free memory
  • Run iterative jobs with large input files, which can occupy most of the free memory on each compute host.
  • Run iterative jobs with more than a few iterations.
Note: To uniquely identify an input split and to name the index of the cache, cache-aware scheduling uses the toString() output string of the input split subclass, which is specified at job submission. It is important, therefore, to ensure that you name the file uniquely.

Procedure

  1. Verify or change the properties specified in the MRSS configuration file:
    1. Open the $EGO_ESRVDIR/esc/conf/services/mrss.xml file.
    2. Ensure that values for the following properties are set correctly in the file:
      • PMR_MRSS_CACHE_PATH: Specifies a location on the local disk to store the map file of the input split. The default location is ${PMR_HOME}/work/datacache.
      • PMR_MRSS_INPUTCACHE_MAX_MEMSIZE_MB: Specifies the maximum memory limit of the input split cache (in MB). The default value is 2 GB. If the size of the total memory cache does not exceed the configured size, the cache files are mapped to system memory and used as in-memory cache. If the size of the total memory cache exceeds the configured size, the cache files are not mapped to system memory but are instead used as on-disk cache.
      • PMR_MRSS_INPUTCACHE_CLEAN_INTERVAL: Specifies the duration (in seconds) that a split is cached without being accessed by any job of any application. When a split cache exceeds this duration, the data input split (and its local disk file) are deleted from the MRSS cache. The default value is 3600 seconds.
    3. If you change any of the properties, save the file and restart EGO and MRSS on the host.
  2. Enable the pmr.cache.split parameter from the mrsh utility for a single job or in the pmr-site.xml configuration file for all jobs submitted from the host. This option caches the results of the record reader. By default, cache-aware scheduling is disabled (specified as -Dpmr.cache.split=off).
    • To enable cache-aware scheduling for a single job, from the mrsh utility, add the -Dpmr.cache.split=on option to your job submission command.

      $ mrsh jar $MAHOUT_HOME/mahout-examples-*-job.jar org.apache.mahout.driver.MahoutDriver kmeans -Dpmr.cache.split=on

    • To enable cache-aware scheduling for all jobs submitted from the host:
      1. Open the pmr-site.xml configuration file at $PMR_HOME/conf.
      2. Add the pmr.cache.split property.

        For example:

        <property>
          <name>pmr.cache.split</name>
          <value>on</value>
        </property>
        
      3. Save the file.

What to do next

After you have configured cache-aware scheduling, you enable a MapReduce job to retrieve its input split from the cache. You can now submit the job. When the job completes, log on to the cluster management console and access the client output message from the job's Counters tab. You can view the number of map tasks that retrieve their input splits from in-memory cache (Hit_In_Mem) or from on-disk cache (Hit_On_Disk).