Details

    • Type: Sub-task Sub-task
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 0.20.205.0
    • Fix Version/s: None
    • Component/s: task
    • Labels:
      None

      Description

      In our experience, many data aggregation style queries/jobs don't need to sort the intermediate data. In fact reducer side can use hashmap or even array to do application level aggregations. For example, consider computing CTR using display log & click log in sponsored search. Map side just emit (adv_id, clk_cnt, dis_cnt), reduce side aggregate clk_cnt and dis_cnt for every adv_id, cause adv_id is integer, we can partition adv_id by range:

        • reduce0: 0-100000
        • reduce1: 100000-200000
        • ...
        • reduceM: xxx-max adv-id
          Then the reducer can use an array(for example: int [1000000][2]) to store the aggregated clk_cnt & dis_cnt, and we don't need the framework to sort intermediate data anymore.
          By supporting no sort, we can gain a lot of performance improvements:
      1. Eliminate map side sort & merge.
        KV paris need to sort by partition first, but this can be done using a liner time counting sort, which is much faster than quick sort.
        Just merge spill segments one by one, doesn't need to use heap merge.
      2. Eliminate shuffle phrase barrier, reducer can start to processing data before all map output data are copied & merged.

      For most cases, memory won't be a problem, cause keys are divided to many partitions, each reducers only process a small subset of the global key set.

        Activity

        Hide
        Binglin Chang added a comment -

        A preview patch supporting no sort.

        Show
        Binglin Chang added a comment - A preview patch supporting no sort.
        Hide
        Aaron T. Myers added a comment -

        Is this not a duplicate of MAPREDUCE-1639?

        Show
        Aaron T. Myers added a comment - Is this not a duplicate of MAPREDUCE-1639 ?
        Hide
        Binglin Chang added a comment -

        No, grouping is not the same as no sort:

        1. Grouping still needs shuffle phrase barrier;
        2. In grouping kv pairs of the same key are grouped together, but in no sort kv pairs of the same key may not grouped together, framework only promise they are in the same partition(reduce).
        Show
        Binglin Chang added a comment - No, grouping is not the same as no sort: Grouping still needs shuffle phrase barrier; In grouping kv pairs of the same key are grouped together, but in no sort kv pairs of the same key may not grouped together, framework only promise they are in the same partition(reduce).
        Hide
        Binglin Chang added a comment -

        I think why no sort make sense is that, in many cases application has a more efficient way to process data(such as do aggregation on the fly), they don't want the framework to do some sort of heavy weighted data preprocessing, cause they have better prior knowledge/understanding about the data and the goal.

        Show
        Binglin Chang added a comment - I think why no sort make sense is that, in many cases application has a more efficient way to process data(such as do aggregation on the fly), they don't want the framework to do some sort of heavy weighted data preprocessing, cause they have better prior knowledge/understanding about the data and the goal.
        Hide
        anty.rao added a comment -

        The submitted path do not yet eliminated the shuffle phase barrier?

        Show
        anty.rao added a comment - The submitted path do not yet eliminated the shuffle phase barrier?
        Hide
        Binglin Chang added a comment -

        This is already fully functional patch. I have done some simple tests both using localRunner and on a real 17 node cluster. To disable sort, set jobconf mapred.map.output.sort=false. Then the reduce phrase will start before all Map Task have done, and reducer can not expect input k/v pairs to be grouped by key & sorted.

        Show
        Binglin Chang added a comment - This is already fully functional patch. I have done some simple tests both using localRunner and on a real 17 node cluster. To disable sort, set jobconf mapred.map.output.sort=false. Then the reduce phrase will start before all Map Task have done, and reducer can not expect input k/v pairs to be grouped by key & sorted.
        Hide
        Robert Joseph Evans added a comment -

        I have a couple of comments about the patch. NOTE I have just done a quick pass and have not looked in depth at the code. There are several places that I want to pick apart before giving my approval.

        1. Combiners are not compatible with mapred.map.output.sort. Is there a reason why we could not make combiners work with this, so long as they must follow the same assumption that they will not get sorted input? If the algorithms you are thinking about would never get any benefit from a combiner, could you also add the check in the client. I would much rather have the client blow up with an error instead of waiting for my map tasks to launch and then blow up 4+ times before I get the error.
        2. In your test you never validate that the output is what you expected it to be. That may be hard as it may not be deterministic because there is no sorting, but it would be nice to have something verify that the code did work as expected. Not just that it did not crash.
        3. mapred-default.xml Please add mapred.map.output.sort to mapred-default.xml. Include with it a brief explanation of what it does.
        4. There is no documentation or examples. This is a new feature that could be very useful to lots of people, but if they never know it is there it will not be used. Could you include in your patch updates to the documentation about how to use this, and some useful examples, preferably simple. Perhaps an example computing CTR would be nice.
        5. Performance. The entire reason for this change is to improve performance, but I have not seen any numbers showing a performance improvement. No numbers at all in fact. It would be great if you could include here some numbers along with the code you used for your benchmark and a description of your setup. I have spent time on different performance teams, and performance improvement efforts from a huge search engine to an OS on a cell phone and the one thing I have learned is that you have to go off of the numbers because well at least for me my intuition is often wrong and what I thought would make it faster slowed it down instead.
        6. Trunk. This patch is specific to 0.20/1.0 line. Before this can get merged into the 0.20/1.0 lines we really need an equivalent patch for trunk, and possibly 0.21, 0.22, and 0.23. This is so there are no regressions. It may be a while off after you get the 1.0 patch cleaned up though.
        Show
        Robert Joseph Evans added a comment - I have a couple of comments about the patch. NOTE I have just done a quick pass and have not looked in depth at the code. There are several places that I want to pick apart before giving my approval. Combiners are not compatible with mapred.map.output.sort. Is there a reason why we could not make combiners work with this, so long as they must follow the same assumption that they will not get sorted input? If the algorithms you are thinking about would never get any benefit from a combiner, could you also add the check in the client. I would much rather have the client blow up with an error instead of waiting for my map tasks to launch and then blow up 4+ times before I get the error. In your test you never validate that the output is what you expected it to be. That may be hard as it may not be deterministic because there is no sorting, but it would be nice to have something verify that the code did work as expected. Not just that it did not crash. mapred-default.xml Please add mapred.map.output.sort to mapred-default.xml. Include with it a brief explanation of what it does. There is no documentation or examples. This is a new feature that could be very useful to lots of people, but if they never know it is there it will not be used. Could you include in your patch updates to the documentation about how to use this, and some useful examples, preferably simple. Perhaps an example computing CTR would be nice. Performance. The entire reason for this change is to improve performance, but I have not seen any numbers showing a performance improvement. No numbers at all in fact. It would be great if you could include here some numbers along with the code you used for your benchmark and a description of your setup. I have spent time on different performance teams, and performance improvement efforts from a huge search engine to an OS on a cell phone and the one thing I have learned is that you have to go off of the numbers because well at least for me my intuition is often wrong and what I thought would make it faster slowed it down instead. Trunk. This patch is specific to 0.20/1.0 line. Before this can get merged into the 0.20/1.0 lines we really need an equivalent patch for trunk, and possibly 0.21, 0.22, and 0.23. This is so there are no regressions. It may be a while off after you get the 1.0 patch cleaned up though.

          People

          • Assignee:
            Binglin Chang
            Reporter:
            Binglin Chang
          • Votes:
            0 Vote for this issue
            Watchers:
            20 Start watching this issue

            Dates

            • Created:
              Updated:

              Development