Hadoop Map/Reduce
  1. Hadoop Map/Reduce
  2. MAPREDUCE-5822

FairScheduler does not preempt due to fairshare-starvation when fairshare is 1

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.3.0
    • Component/s: scheduler
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      If the fair share returned by the scheduler getFairShare() == 1 the pool will never be marked as being starved because of the following calculation:

      boolean isStarvedForFairShare(PoolSchedulable sched) { 
        int desiredFairShare = (int) Math.floor(Math.min( sched.getFairShare() / 2, sched.getDemand())); 
        return (sched.getRunningTasks() < desiredFairShare); 
      }
      

      getFairShare() returns 1
      Math.min calculation will return 0.5
      Math.Floor() which will cause the desiredFairShare to be set to 0.
      the return value to be 'false' (0 < 0)
      If you have a small job without a minimum set it will not get scheduled if a large job is hogging the slots.

      1. MAPREDUCE-5822.001.patch
        6 kB
        Anubhav Dhoot
      2. MAPREDUCE-5822.002.patch
        6 kB
        Anubhav Dhoot

        Activity

        Hide
        Karthik Kambatla (Inactive) added a comment -

        Thanks for the contribution, Anubhav.

        Just committed this to branch-1.

        Show
        Karthik Kambatla (Inactive) added a comment - Thanks for the contribution, Anubhav. Just committed this to branch-1.
        Hide
        Karthik Kambatla (Inactive) added a comment -

        Patch looks good to me. Nice test. Verified test fails without the fix, and passes with it.

        +1, committing this now.

        Show
        Karthik Kambatla (Inactive) added a comment - Patch looks good to me. Nice test. Verified test fails without the fix, and passes with it. +1, committing this now.
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12639870/MAPREDUCE-5822.002.patch
        against trunk revision .

        -1 patch. The patch command could not apply the patch.

        Console output: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/4504//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12639870/MAPREDUCE-5822.002.patch against trunk revision . -1 patch . The patch command could not apply the patch. Console output: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/4504//console This message is automatically generated.
        Hide
        Anubhav Dhoot added a comment -

        ran tests under fairscheduler and they passed

        Show
        Anubhav Dhoot added a comment - ran tests under fairscheduler and they passed
        Hide
        Anubhav Dhoot added a comment -

        As per karthik's suggestion. Thx much cleaner.

        Show
        Anubhav Dhoot added a comment - As per karthik's suggestion. Thx much cleaner.
        Hide
        Karthik Kambatla (Inactive) added a comment -

        Since we just want to check if the allocation is less than half the fair-share, how about multiplying the allocation (and demand) by 2 and comparing against the fair-share? That would make it all integer operations.

        Show
        Karthik Kambatla (Inactive) added a comment - Since we just want to check if the allocation is less than half the fair-share, how about multiplying the allocation (and demand) by 2 and comparing against the fair-share? That would make it all integer operations.
        Hide
        Anubhav Dhoot added a comment -

        Ran test-contrib task in ant and they passed.

        Show
        Anubhav Dhoot added a comment - Ran test-contrib task in ant and they passed.
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12639286/MAPREDUCE-5822.001.patch
        against trunk revision .

        -1 patch. The patch command could not apply the patch.

        Console output: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/4493//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12639286/MAPREDUCE-5822.001.patch against trunk revision . -1 patch . The patch command could not apply the patch. Console output: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/4493//console This message is automatically generated.
        Hide
        Anubhav Dhoot added a comment -

        Changed the calculation to set it to 1 if the value of half of fair share is between 0 and 1.
        Added a unit test that verifies fair share starvation preemption kicks in even when half of fair share is between 0 and 1.

        Show
        Anubhav Dhoot added a comment - Changed the calculation to set it to 1 if the value of half of fair share is between 0 and 1. Added a unit test that verifies fair share starvation preemption kicks in even when half of fair share is between 0 and 1.
        Hide
        Sandy Ryza added a comment -

        This looks like an MR1 issue, so moving it to MAPREDUCE.

        Show
        Sandy Ryza added a comment - This looks like an MR1 issue, so moving it to MAPREDUCE.

          People

          • Assignee:
            Anubhav Dhoot
            Reporter:
            Anubhav Dhoot
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development