You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by caneGuy <gi...@git.apache.org> on 2017/09/08 12:26:59 UTC

[GitHub] spark pull request #19168: [SPARK-21956][CORE] Fetch up to max bytes when bu...

GitHub user caneGuy opened a pull request:

    https://github.com/apache/spark/pull/19168

    [SPARK-21956][CORE] Fetch up to max bytes when buf really been released

    ## What changes were proposed in this pull request?
    
    Right now,ShuffleBlockFetcherIterator will decrease bytesInFlight immediatily when take from results queue.But currentresult's bytebuf has not been released at that time.Then direct memory may be a little out of control.
    We should decrease bytesInFlight when currentresult's bytebuf really been released.
    
    ## How was this patch tested?
    
    Exsisted Unit test


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

    $ git pull https://github.com/caneGuy/spark zhoukang/fix-fetch

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

    https://github.com/apache/spark/pull/19168.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 #19168
    
----
commit 0a473bbf905874006711126f5b7375845df802db
Author: zhoukang <zh...@gmail.com>
Date:   2017-09-08T09:39:38Z

    [SPARK-MI][CORE] Fetch up to max bytes when buf really released

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #19168: [SPARK-21956][CORE] Fetch up to max bytes when buf reall...

Posted by caneGuy <gi...@git.apache.org>.
Github user caneGuy commented on the issue:

    https://github.com/apache/spark/pull/19168
  
    @cloud-fan  Sorry for bothering you.Could you help review this?Thanks


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #19168: [SPARK-21956][CORE] Fetch up to max bytes when bu...

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

    https://github.com/apache/spark/pull/19168


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #19168: [SPARK-21956][CORE] Fetch up to max bytes when buf reall...

Posted by caneGuy <gi...@git.apache.org>.
Github user caneGuy commented on the issue:

    https://github.com/apache/spark/pull/19168
  
    Sorry for replying so late.
    I add some benchmark testing for this pr @kiszk .
    And @jerryshao could you help review this pr?Thanks
    ```
    Running benchmark: Benchmark fetch before vs after releasing buffer
      Running case: Testing fetch before releasing!
      Stopped after 10 iterations, 2423 ms
      Running case: Testing fetch after releasing!
      Stopped after 18 iterations, 2036 ms
    
    Java HotSpot(TM) 64-Bit Server VM 1.8.0_25-b17 on Linux 4.4.0-64-generic
    Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
    Benchmark fetch before vs after releasing buffer: Best/Avg Time(ms)    Rate(M/s)   Per Row(ns)   Relative
    ------------------------------------------------------------------------------------------------
    Testing fetch before releasing!                 46 /  242        345.0           2.9       1.0X
    Testing fetch after releasing!                  73 /  113        215.7           4.6       0.6X
    ```
    ```
    Running benchmark: Benchmark fetch before vs after releasing buffer
      Running case: Testing fetch before releasing!
      Stopped after 10 iterations, 3888 ms
      Running case: Testing fetch after releasing!
      Stopped after 10 iterations, 3970 ms
    
    Java HotSpot(TM) 64-Bit Server VM 1.8.0_25-b17 on Linux 4.4.0-64-generic
    Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
    Benchmark fetch before vs after releasing buffer: Best/Avg Time(ms)    Rate(M/s)   Per Row(ns)   Relative
    ------------------------------------------------------------------------------------------------
    Testing fetch before releasing!                100 /  389        157.8           6.3       1.0X
    Testing fetch after releasing!                 151 /  397        104.3           9.6       0.7X
    ```
    ```
    Running benchmark: Benchmark fetch before vs after releasing buffer
      Running case: Testing fetch before releasing!
      Stopped after 15 iterations, 2016 ms
      Running case: Testing fetch after releasing!
      Stopped after 14 iterations, 2110 ms
    
    Java HotSpot(TM) 64-Bit Server VM 1.8.0_25-b17 on Linux 4.4.0-64-generic
    Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
    Benchmark fetch before vs after releasing buffer: Best/Avg Time(ms)    Rate(M/s)   Per Row(ns)   Relative
    ------------------------------------------------------------------------------------------------
    Testing fetch before releasing!                 43 /  134        363.8           2.7       1.0X
    Testing fetch after releasing!                  99 /  151        158.1           6.3       0.4X
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #19168: [SPARK-21956][CORE] Fetch up to max bytes when buf reall...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/19168
  
    Technically speaking, `maxBytesInFlight` controls how many bytes are being transferred in network, so we should decrease `bytesInFlight` once we get data from the result queue. The actual memory usage usually beyond `maxBytesInFlight`, because the network transfer needs memory, and the fetched data which is being processed also needs memory. This is not a big problem because the worst case is we consume `maxBytesInFlight * 2` memory.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #19168: [SPARK-21956][CORE] Fetch up to max bytes when buf reall...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19168
  
    Can one of the admins verify this patch?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #19168: [SPARK-21956][CORE] Fetch up to max bytes when buf reall...

Posted by kiszk <gi...@git.apache.org>.
Github user kiszk commented on the issue:

    https://github.com/apache/spark/pull/19168
  
    IIUC, this change defers sending requests to remote notes until `releaseCurrentResultBuffer()` will be called.
    Do you have any benchmark results to confirm no performance degradation?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #19168: [SPARK-21956][CORE] Fetch up to max bytes when buf reall...

Posted by caneGuy <gi...@git.apache.org>.
Github user caneGuy commented on the issue:

    https://github.com/apache/spark/pull/19168
  
    Yes you are right @kiszk Benchmark on the way.I will put here later.Thanks for your time @kiszk 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #19168: [SPARK-21956][CORE] Fetch up to max bytes when bu...

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

    https://github.com/apache/spark/pull/19168#discussion_r141060766
  
    --- Diff: core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala ---
    @@ -439,6 +443,8 @@ final class ShuffleBlockFetcherIterator(
                       fetchRequests += FetchRequest(address, Array((blockId, size)))
                       result = null
                     }
    +                bytesInFlight -= size
    +                fetchUpToMaxBytes()
    --- End diff --
    
    we may throw exception before hitting this branch


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #19168: [SPARK-21956][CORE] Fetch up to max bytes when buf reall...

Posted by caneGuy <gi...@git.apache.org>.
Github user caneGuy commented on the issue:

    https://github.com/apache/spark/pull/19168
  
    Thanks @cloud-fan i will close this pr.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #19168: [SPARK-21956][CORE] Fetch up to max bytes when bu...

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

    https://github.com/apache/spark/pull/19168#discussion_r137780881
  
    --- Diff: core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala ---
    @@ -157,7 +157,14 @@ final class ShuffleBlockFetcherIterator(
       private[storage] def releaseCurrentResultBuffer(): Unit = {
         // Release the current buffer if necessary
         if (currentResult != null) {
    --- End diff --
    
    I can't evaluate the change, but, the 'null' case is now already handled by your `case _`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #19168: [SPARK-21956][CORE] Fetch up to max bytes when bu...

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

    https://github.com/apache/spark/pull/19168#discussion_r141228856
  
    --- Diff: core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala ---
    @@ -439,6 +443,8 @@ final class ShuffleBlockFetcherIterator(
                       fetchRequests += FetchRequest(address, Array((blockId, size)))
                       result = null
                     }
    +                bytesInFlight -= size
    +                fetchUpToMaxBytes()
    --- End diff --
    
    Thanks @cloud-fan 
    IIUC, i think when  `fetchfailedException` thrown there is no need to consider this.Which is also the original design.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org