You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by greghogan <gi...@git.apache.org> on 2015/09/10 19:12:38 UTC

[GitHub] flink pull request: [FLINK-2655] Minimize intermediate merging of ...

GitHub user greghogan opened a pull request:

    https://github.com/apache/flink/pull/1118

    [FLINK-2655] Minimize intermediate merging of spilled buffers

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/greghogan/flink 2655_mimimize_intermediate_merging_of_spilled_buffers

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/1118.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1118
    
----

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-2655] Minimize intermediate merging of ...

Posted by HuangWHWHW <gi...@git.apache.org>.
Github user HuangWHWHW commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1118#discussion_r39252417
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java ---
    @@ -1525,34 +1525,41 @@ protected final void disposeSortBuffers(boolean releaseMemory) {
     					final List<MemorySegment> allReadBuffers, final List<MemorySegment> writeBuffers)
     		throws IOException
     		{
    -			final double numMerges = Math.ceil(channelIDs.size() / ((double) this.maxFanIn));
    -			final int channelsToMergePerStep = (int) Math.ceil(channelIDs.size() / numMerges);
    -			
    +			// A channel list with length maxFanIn<sup>i</sup> can be merged to maxFanIn files in i-1 rounds where every merge
    +			// is a full merge with maxFanIn input channels. A partial round includes merges with fewer than maxFanIn
    +			// inputs. It is most efficient to perform the partial round first.
    +			final double scale = Math.ceil(Math.log(channelIDs.size()) / Math.log(this.maxFanIn)) - 1;
    +
    +			final int numStart = channelIDs.size();
    +			final int numEnd = (int) Math.pow(this.maxFanIn, scale);
    +
    +			final int numMerges = (int) Math.ceil((numStart - numEnd) / (double) (this.maxFanIn - 1));
    --- End diff --
    
    Ah, thanks for this info :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-2655] Minimize intermediate merging of ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/1118


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-2655] Minimize intermediate merging of ...

Posted by HuangWHWHW <gi...@git.apache.org>.
Github user HuangWHWHW commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1118#discussion_r39232369
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java ---
    @@ -1525,34 +1525,41 @@ protected final void disposeSortBuffers(boolean releaseMemory) {
     					final List<MemorySegment> allReadBuffers, final List<MemorySegment> writeBuffers)
     		throws IOException
     		{
    -			final double numMerges = Math.ceil(channelIDs.size() / ((double) this.maxFanIn));
    -			final int channelsToMergePerStep = (int) Math.ceil(channelIDs.size() / numMerges);
    -			
    +			// A channel list with length maxFanIn<sup>i</sup> can be merged to maxFanIn files in i-1 rounds where every merge
    +			// is a full merge with maxFanIn input channels. A partial round includes merges with fewer than maxFanIn
    +			// inputs. It is most efficient to perform the partial round first.
    +			final double scale = Math.ceil(Math.log(channelIDs.size()) / Math.log(this.maxFanIn)) - 1;
    +
    +			final int numStart = channelIDs.size();
    +			final int numEnd = (int) Math.pow(this.maxFanIn, scale);
    +
    +			final int numMerges = (int) Math.ceil((numStart - numEnd) / (double) (this.maxFanIn - 1));
    --- End diff --
    
    Are you sure the `this.maxFanIn` will never equal 1(avoid dividing 0)?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-2655] Minimize intermediate merging of ...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1118#discussion_r39250889
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java ---
    @@ -1525,34 +1525,41 @@ protected final void disposeSortBuffers(boolean releaseMemory) {
     					final List<MemorySegment> allReadBuffers, final List<MemorySegment> writeBuffers)
     		throws IOException
     		{
    -			final double numMerges = Math.ceil(channelIDs.size() / ((double) this.maxFanIn));
    -			final int channelsToMergePerStep = (int) Math.ceil(channelIDs.size() / numMerges);
    -			
    +			// A channel list with length maxFanIn<sup>i</sup> can be merged to maxFanIn files in i-1 rounds where every merge
    +			// is a full merge with maxFanIn input channels. A partial round includes merges with fewer than maxFanIn
    +			// inputs. It is most efficient to perform the partial round first.
    +			final double scale = Math.ceil(Math.log(channelIDs.size()) / Math.log(this.maxFanIn)) - 1;
    +
    +			final int numStart = channelIDs.size();
    +			final int numEnd = (int) Math.pow(this.maxFanIn, scale);
    +
    +			final int numMerges = (int) Math.ceil((numStart - numEnd) / (double) (this.maxFanIn - 1));
    --- End diff --
    
    Yes, `maxFanIn` is a configuration parameter and must be > 1.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-2655] Minimize intermediate merging of ...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the pull request:

    https://github.com/apache/flink/pull/1118#issuecomment-140212980
  
    Will merge this PR tomorrow.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [FLINK-2655] Minimize intermediate merging of ...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the pull request:

    https://github.com/apache/flink/pull/1118#issuecomment-139544590
  
    Thanks for the PR @greghogan.
    Good to merge, IMO.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---