Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0
    • Component/s: task
    • Labels:
      None
    • Environment:

      x86-64 Linux/Unix

    • Hadoop Flags:
      Reviewed
    • Release Note:
      Hide
      Adds a native implementation of the map output collector. The native library will build automatically with -Pnative. Users may choose the new collector on a job-by-job basis by setting mapreduce.job.map.output.collector.class=org.apache.hadoop.mapred.
      nativetask.NativeMapOutputCollectorDelegator in their job configuration. For shuffle-intensive jobs this may provide speed-ups of 30% or more.
      Show
      Adds a native implementation of the map output collector. The native library will build automatically with -Pnative. Users may choose the new collector on a job-by-job basis by setting mapreduce.job.map.output.collector.class=org.apache.hadoop.mapred. nativetask.NativeMapOutputCollectorDelegator in their job configuration. For shuffle-intensive jobs this may provide speed-ups of 30% or more.
    • Tags:
      optimization task

      Description

      I'm recently working on native optimization for MapTask based on JNI.

      The basic idea is that, add a NativeMapOutputCollector to handle k/v pairs emitted by mapper, therefore sort, spill, IFile serialization can all be done in native code, preliminary test(on Xeon E5410, jdk6u24) showed promising results:

      1. Sort is about 3x-10x as fast as java(only binary string compare is supported)

      2. IFile serialization speed is about 3x of java, about 500MB/s, if hardware CRC32C is used, things can get much faster(1G/

      3. Merge code is not completed yet, so the test use enough io.sort.mb to prevent mid-spill

      This leads to a total speed up of 2x~3x for the whole MapTask, if IdentityMapper(mapper does nothing) is used

      There are limitations of course, currently only Text and BytesWritable is supported, and I have not think through many things right now, such as how to support map side combine. I had some discussion with somebody familiar with hive, it seems that these limitations won't be much problem for Hive to benefit from those optimizations, at least. Advices or discussions about improving compatibility are most welcome

      Currently NativeMapOutputCollector has a static method called canEnable(), which checks if key/value type, comparator type, combiner are all compatible, then MapTask can choose to enable NativeMapOutputCollector.

      This is only a preliminary test, more work need to be done. I expect better final results, and I believe similar optimization can be adopt to reduce task and shuffle too.

      1. mr-2841-merge-4.patch
        2.68 MB
        Sean Zhong
      2. mr-2841-merge-3.patch
        2.73 MB
        Sean Zhong
      3. mr-2841-merge-2.txt
        2.70 MB
        Sean Zhong
      4. mr-2841-merge.txt
        2.72 MB
        Todd Lipcon
      5. MR-2841benchmarks.pdf
        213 kB
        Todd Lipcon
      6. micro-benchmark.txt
        13 kB
        Todd Lipcon
      7. hadoop-3.0-mapreduce-2841-2014-7-17.patch
        3.50 MB
        Sean Zhong
      8. fb-shuffle.patch
        76 kB
        Todd Lipcon
      9. DESIGN.html
        42 kB
        Binglin Chang
      10. MAPREDUCE-2841.v2.patch
        190 kB
        Binglin Chang
      11. dualpivotv20-0.patch
        4 kB
        Chris Douglas
      12. dualpivot-0.patch
        5 kB
        Chris Douglas
      13. MAPREDUCE-2841.v1.patch
        180 kB
        Binglin Chang

        Issue Links

        1.
        Allow specifying multiple MapOutputCollectors with fallback Sub-task Closed Todd Lipcon
         
        2.
        Fix native-task build on Ubuntu 13.10 Sub-task Resolved Todd Lipcon
         
        3.
        native-task should not fail to build if snappy is missing Sub-task Resolved Sean Zhong
         
        4.
        Fix or suppress native-task gcc warnings Sub-task Resolved Manu Zhang
         
        5.
        native-task CompressTest failure on Ubuntu Sub-task Resolved Manu Zhang
         
        6.
        native-task: reuse lz4 sources in hadoop-common Sub-task Resolved Binglin Chang
         
        7.
        native-task: Fix build on macosx Sub-task Resolved Binglin Chang
         
        8.
        native-task: Unit test TestGlibCBug fails on ubuntu Sub-task Resolved Sean Zhong
         
        9.
        native-task should not run unit tests if native profile is not enabled Sub-task Resolved Binglin Chang
         
        10. native-task test logs should not write to console Sub-task Open Unassigned
         
        11.
        native-task: simplify/remove dead code Sub-task Resolved Unassigned
         
        12.
        native-task: TestBytesUtil fails Sub-task Resolved Todd Lipcon
         
        13.
        native-task: revert changes which expose Text internals Sub-task Resolved Todd Lipcon
         
        14.
        native-task: Rename system tests into standard directory layout Sub-task Resolved Todd Lipcon
         
        15.
        native-task: Use DirectBufferPool from Hadoop Common Sub-task Resolved Todd Lipcon
         
        16.
        native-task: Simplify ByteBufferDataReader/Writer Sub-task Resolved Todd Lipcon
         
        17.
        native-task should not fail to build if zlib is missing Sub-task Resolved Unassigned
         
        18.
        native-task: fix some valgrind errors Sub-task Resolved Binglin Chang
         
        19.
        native-task: add native tests to maven and fix bug in pom.xml Sub-task Resolved Binglin Chang
         
        20.
        native-task: fix native library distribution Sub-task Resolved Manu Zhang
         
        21.
        native-task: fix logging Sub-task Resolved Manu Zhang
         
        22.
        native-task: sources/test-sources jar distribution Sub-task Resolved Manu Zhang
         
        23.
        native-task: speed up test runs Sub-task Resolved Todd Lipcon
         
        24.
        native-task: findbugs, interface annotations, and other misc cleanup Sub-task Resolved Todd Lipcon
         
        25.
        nativetask: move system test working dir to target dir and cleanup test config xml files Sub-task Resolved Manu Zhang
         
        26.
        native-task: KVTest and LargeKVTest should check mr job is sucessful Sub-task Resolved Binglin Chang
         
        27.
        native-task: warnings about illegal Progress values Sub-task Resolved Manu Zhang
         
        28.
        native-task: fix some counter issues Sub-task Resolved Binglin Chang
         
        29.
        native-task: Style fixups and dead code removal Sub-task Resolved Todd Lipcon
         
        30.
        native-task: fix release audit, javadoc, javac warnings Sub-task Resolved Todd Lipcon
         
        31.
        Remove CustomModule examples in nativetask Sub-task Resolved Sean Zhong
         
        32.
        native-task: fix gtest build on macosx Sub-task Resolved Binglin Chang
         

          Activity

          Binglin Chang created issue -
          Binglin Chang made changes -
          Field Original Value New Value
          Assignee Binglin Chang [ decster ]
          Binglin Chang made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Binglin Chang made changes -
          Attachment MAPREDUCE-2841.v1.patch [ 12490790 ]
          Chris Douglas made changes -
          Attachment dualpivot-0.patch [ 12491994 ]
          Attachment dualpivotv20-0.patch [ 12491995 ]
          Binglin Chang made changes -
          Attachment MAPREDUCE-2841.v2.patch [ 12492208 ]
          Binglin Chang made changes -
          Link This issue relates to MAPREDUCE-3246 [ MAPREDUCE-3246 ]
          Binglin Chang made changes -
          Link This issue relates to MAPREDUCE-3247 [ MAPREDUCE-3247 ]
          Binglin Chang made changes -
          Attachment DESIGN.html [ 12512978 ]
          Dong Yang made changes -
          Link This issue relates to MAPREDUCE-1270 [ MAPREDUCE-1270 ]
          chwcrazy made changes -
          Description I'm recently working on native optimization for MapTask based on JNI.

          The basic idea is that, add a NativeMapOutputCollector to handle k/v pairs emitted by mapper, therefore sort, spill, IFile serialization can all be done in native code, preliminary test(on Xeon E5410, jdk6u24) showed promising results:

          1. Sort is about 3x-10x as fast as java(only binary string compare is supported)

          2. IFile serialization speed is about 3x of java, about 500MB/s, if hardware CRC32C is used, things can get much faster(1G/s).

          3. Merge code is not completed yet, so the test use enough io.sort.mb to prevent mid-spill

          This leads to a total speed up of 2x~3x for the whole MapTask, if IdentityMapper(mapper does nothing) is used.

          There are limitations of course, currently only Text and BytesWritable is supported, and I have not think through many things right now, such as how to support map side combine. I had some discussion with somebody familiar with hive, it seems that these limitations won't be much problem for Hive to benefit from those optimizations, at least. Advices or discussions about improving compatibility are most welcome:)

          Currently NativeMapOutputCollector has a static method called canEnable(), which checks if key/value type, comparator type, combiner are all compatible, then MapTask can choose to enable NativeMapOutputCollector.

          This is only a preliminary test, more work need to be done. I expect better final results, and I believe similar optimization can be adopt to reduce task and shuffle too.




          I'm recently working on native optimization for MapTask based on JNI.

          The basic idea is that, add a NativeMapOutputCollector to handle k/v pairs emitted by mapper, therefore sort, spill, IFile serialization can all be done in native code, preliminary test(on Xeon E5410, jdk6u24) showed promising results:

          1. Sort is about 3x-10x as fast as java(only binary string compare is supported)

          2. IFile serialization speed is about 3x of java, about 500MB/s, if hardware CRC32C is used, things can get much faster(1G/

          3. Merge code is not completed yet, so the test use enough io.sort.mb to prevent mid-spill

          This leads to a total speed up of 2x~3x for the whole MapTask, if IdentityMapper(mapper does nothing) is used.

          There are limitations of course, currently only Text and BytesWritable is supported, and I have not think through many things right now, such as how to support map side combine. I had some discussion with somebody familiar with hive, it seems that these limitations won't be much problem for Hive to benefit from those optimizations, at least. Advices or discussions about improving compatibility are most welcome:)

          Currently NativeMapOutputCollector has a static method called canEnable(), which checks if key/value type, comparator type, combiner are all compatible, then MapTask can choose to enable NativeMapOutputCollector.

          This is only a preliminary test, more work need to be done. I expect better final results, and I believe similar optimization can be adopt to reduce task and shuffle too.




          chwcrazy made changes -
          Description I'm recently working on native optimization for MapTask based on JNI.

          The basic idea is that, add a NativeMapOutputCollector to handle k/v pairs emitted by mapper, therefore sort, spill, IFile serialization can all be done in native code, preliminary test(on Xeon E5410, jdk6u24) showed promising results:

          1. Sort is about 3x-10x as fast as java(only binary string compare is supported)

          2. IFile serialization speed is about 3x of java, about 500MB/s, if hardware CRC32C is used, things can get much faster(1G/

          3. Merge code is not completed yet, so the test use enough io.sort.mb to prevent mid-spill

          This leads to a total speed up of 2x~3x for the whole MapTask, if IdentityMapper(mapper does nothing) is used.

          There are limitations of course, currently only Text and BytesWritable is supported, and I have not think through many things right now, such as how to support map side combine. I had some discussion with somebody familiar with hive, it seems that these limitations won't be much problem for Hive to benefit from those optimizations, at least. Advices or discussions about improving compatibility are most welcome:)

          Currently NativeMapOutputCollector has a static method called canEnable(), which checks if key/value type, comparator type, combiner are all compatible, then MapTask can choose to enable NativeMapOutputCollector.

          This is only a preliminary test, more work need to be done. I expect better final results, and I believe similar optimization can be adopt to reduce task and shuffle too.




          I'm recently working on native optimization for MapTask based on JNI.

          The basic idea is that, add a NativeMapOutputCollector to handle k/v pairs emitted by mapper, therefore sort, spill, IFile serialization can all be done in native code, preliminary test(on Xeon E5410, jdk6u24) showed promising results:

          1. Sort is about 3x-10x as fast as java(only binary string compare is supported)

          2. IFile serialization speed is about 3x of java, about 500MB/s, if hardware CRC32C is used, things can get much faster(1G/

          3. Merge code is not completed yet, so the test use enough io.sort.mb to prevent mid-spill

          This leads to a total speed up of 2x~3x for the whole MapTask, if IdentityMapper(mapper does nothing) is used

          There are limitations of course, currently only Text and BytesWritable is supported, and I have not think through many things right now, such as how to support map side combine. I had some discussion with somebody familiar with hive, it seems that these limitations won't be much problem for Hive to benefit from those optimizations, at least. Advices or discussions about improving compatibility are most welcome:)

          Currently NativeMapOutputCollector has a static method called canEnable(), which checks if key/value type, comparator type, combiner are all compatible, then MapTask can choose to enable NativeMapOutputCollector.

          This is only a preliminary test, more work need to be done. I expect better final results, and I believe similar optimization can be adopt to reduce task and shuffle too.




          chwcrazy made changes -
          Environment x86-64 Linux x86-64 Linux/Unix
          Todd Lipcon made changes -
          Attachment fb-shuffle.patch [ 12638882 ]
          Todd Lipcon made changes -
          Assignee Binglin Chang [ decster ] Sean Zhong [ clockfly ]
          Todd Lipcon made changes -
          Link This issue is related to MAPREDUCE-5962 [ MAPREDUCE-5962 ]
          Sean Zhong made changes -
          Status Patch Available [ 10002 ] Open [ 1 ]
          Sean Zhong made changes -
          Todd Lipcon made changes -
          Link This issue is related to HADOOP-10855 [ HADOOP-10855 ]
          Todd Lipcon made changes -
          Attachment micro-benchmark.txt [ 12665471 ]
          Todd Lipcon made changes -
          Attachment MR-2841benchmarks.pdf [ 12666128 ]
          Todd Lipcon made changes -
          Attachment mr-2841-merge.txt [ 12666832 ]
          Todd Lipcon made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Sean Zhong made changes -
          Status Patch Available [ 10002 ] In Progress [ 3 ]
          Sean Zhong made changes -
          Attachment mr-2841-merge-2.txt [ 12666979 ]
          Sean Zhong made changes -
          Status In Progress [ 3 ] Patch Available [ 10002 ]
          Sean Zhong made changes -
          Attachment mr-2841-merge-3.patch [ 12666986 ]
          Sean Zhong made changes -
          Status Patch Available [ 10002 ] In Progress [ 3 ]
          Sean Zhong made changes -
          Status In Progress [ 3 ] Patch Available [ 10002 ]
          Sean Zhong made changes -
          Status Patch Available [ 10002 ] In Progress [ 3 ]
          Sean Zhong made changes -
          Status In Progress [ 3 ] Patch Available [ 10002 ]
          Sean Zhong made changes -
          Status Patch Available [ 10002 ] Open [ 1 ]
          Sean Zhong made changes -
          Attachment mr-2841-merge-4.patch [ 12667067 ]
          Sean Zhong made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Todd Lipcon made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Hadoop Flags Reviewed [ 10343 ]
          Release Note Task level native optimization Adds a native implementation of the map output collector. The native library will build automatically with -Pnative. Users may choose the new collector on a job-by-job basis by setting mapreduce.job.map.output.collector.class=org.apache.hadoop.mapred.
          nativetask.NativeMapOutputCollectorDelegator in their job configuration. For shuffle-intensive jobs this may provide speed-ups of 30% or more.
          Fix Version/s 3.0.0 [ 12320355 ]
          Resolution Fixed [ 1 ]
          Allen Wittenauer made changes -
          Link This issue relates to MAPREDUCE-6106 [ MAPREDUCE-6106 ]

            People

            • Assignee:
              Sean Zhong
              Reporter:
              Binglin Chang
            • Votes:
              4 Vote for this issue
              Watchers:
              69 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development