You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by "marin-ma (via GitHub)" <gi...@apache.org> on 2024/08/06 10:53:21 UTC

[PR] [VL] Reduce memory waste in sort based shuffle [incubator-gluten]

marin-ma opened a new pull request, #6727:
URL: https://github.com/apache/incubator-gluten/pull/6727

   During sort-based shuffle c2r conversion, 64k buffers are allocated to hold the row data. A new 64k buffer will be allocated when the rest space is not enough to hold one more row. However, when allocating a Velox buffer, the capacity can be 1.5x larger than the size, leading to huge memory waste.
   
   ```
   W0806 09:47:47.876497 526671 VeloxSortShuffleWriter.cc:323] acquire new buffer. current capacity: 100663200, size: 67108864, pageCursor: 67108861, unused: 33554339
   ```
   
   This PR sets the allocated buffer size to its capacity to minimize memory waste:
   
   ```
   W0806 10:38:23.872462 552313 VeloxSortShuffleWriter.cc:323] acquire new buffer. current capacity: 100663200, size: 100663200, pageCursor: 100663199, unused: 1
   ```
   
   There will be less spill with this patch when executor memory is low.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Reduce memory waste in sort based shuffle [incubator-gluten]

Posted by "marin-ma (via GitHub)" <gi...@apache.org>.
marin-ma merged PR #6727:
URL: https://github.com/apache/incubator-gluten/pull/6727


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Reduce memory waste in sort based shuffle [incubator-gluten]

Posted by "marin-ma (via GitHub)" <gi...@apache.org>.
marin-ma commented on PR #6727:
URL: https://github.com/apache/incubator-gluten/pull/6727#issuecomment-2272727273

   TPCH SF3T 40000 shuffle partitions, both use sort-based shuffle
   
   query | log/native_6727_time.csv | log/native_master_08_06_2024_time.csv | difference | percentage
   -- | -- | -- | -- | --
   q1 | 26.89 | 26.34 | -0.548 | 97.96%
   q2 | 32.10 | 32.01 | -0.089 | 99.72%
   q3 | 50.69 | 51.21 | 0.521 | 101.03%
   q4 | 38.79 | 39.64 | 0.849 | 102.19%
   q5 | 133.80 | 141.41 | 7.616 | 105.69%
   q6 | 8.85 | 9.67 | 0.813 | 109.19%
   q7 | 116.28 | 119.92 | 3.638 | 103.13%
   q8 | 116.61 | 135.06 | 18.453 | 115.82%
   q9 | 166.31 | 181.74 | 15.431 | 109.28%
   q10 | 56.53 | 55.53 | -1.005 | 98.22%
   q11 | 28.35 | 28.36 | 0.015 | 100.05%
   q12 | 24.71 | 24.28 | -0.427 | 98.27%
   q13 | 35.98 | 35.67 | -0.310 | 99.14%
   q14 | 15.73 | 16.23 | 0.502 | 103.19%
   q15 | 34.01 | 34.76 | 0.752 | 102.21%
   q16 | 18.83 | 19.93 | 1.102 | 105.85%
   q17 | 139.04 | 152.35 | 13.317 | 109.58%
   q18 | 170.89 | 183.05 | 12.157 | 107.11%
   q19 | 17.82 | 22.84 | 5.021 | 128.17%
   q20 | 35.16 | 36.86 | 1.701 | 104.84%
   q21 | 270.74 | 287.90 | 17.160 | 106.34%
   q22 | 20.78 | 21.19 | 0.403 | 101.94%
   total | 1558.88 | 1655.95 | 97.073 | 106.23%
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Reduce memory waste in sort based shuffle [incubator-gluten]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #6727:
URL: https://github.com/apache/incubator-gluten/pull/6727#issuecomment-2270990149

   <!--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
     regarding copyright ownership.  The ASF licenses this file
     to you under the Apache License, Version 2.0 (the
     "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICEGJ-2.0
   
     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
   -->
   
   Thanks for opening a pull request!
   
   Could you open an issue for this pull request on Github Issues?
   
   https://github.com/apache/incubator-gluten/issues
   
   Then could you also rename ***commit message*** and ***pull request title*** in the following format?
   
       [GLUTEN-${ISSUES_ID}][COMPONENT]feat/fix: ${detailed message}
   
   See also:
   
     * [Other pull requests](https://github.com/apache/incubator-gluten/pulls/)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Reduce memory waste in sort based shuffle [incubator-gluten]

Posted by "FelixYBW (via GitHub)" <gi...@apache.org>.
FelixYBW commented on PR #6727:
URL: https://github.com/apache/incubator-gluten/pull/6727#issuecomment-2272421164

   Do you have spill size comparison between hash and sort shuffle?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Reduce memory waste in sort based shuffle [incubator-gluten]

Posted by "marin-ma (via GitHub)" <gi...@apache.org>.
marin-ma commented on PR #6727:
URL: https://github.com/apache/incubator-gluten/pull/6727#issuecomment-2272452018

   > Do you have spill size comparison between hash and sort shuffle?
   
   @FelixYBW We have the spill time comparison for TPCH sf3T. hash-based shuffle spill time is 0. Before this patch, sort-based spill time is 24s, after this patch it's 0.
   
   The spill size is always 0, seems like something goes wrong when reporting the spill size to spark. I will take a look.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org