GitHub user shenh062326 opened a pull request:

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

    [SPARK-6738] [CORE] Improve estimate the size of a large array

    Currently, SizeEstimator.visitArray is not correct in the follow case, 
    array size > 200, 
    elem has the share object
    
    when I add a debug log in SizeTracker.scala:
     logInfo(s"numUpdates:$numUpdates, size:$ts, 
bytesPerUpdate:$bytesPerUpdate, cost time:$b")
    
    I got the following log:
     numUpdates:1, size:262448, bytesPerUpdate:0.0, cost time:35
     numUpdates:2, size:420698, bytesPerUpdate:158250.0, cost time:35
     numUpdates:4, size:420754, bytesPerUpdate:28.0, cost time:32
     numUpdates:7, size:420754, bytesPerUpdate:0.0, cost time:27
     numUpdates:12, size:420754, bytesPerUpdate:0.0, cost time:28
     numUpdates:20, size:420754, bytesPerUpdate:0.0, cost time:25
     numUpdates:32, size:420754, bytesPerUpdate:0.0, cost time:21
     numUpdates:52, size:420754, bytesPerUpdate:0.0, cost time:20
     numUpdates:84, size:420754, bytesPerUpdate:0.0, cost time:20
     numUpdates:135, size:420754, bytesPerUpdate:0.0, cost time:20
     numUpdates:216, size:420754, bytesPerUpdate:0.0, cost time:11
     numUpdates:346, size:420754, bytesPerUpdate:0.0, cost time:6
     numUpdates:554, size:488911, bytesPerUpdate:327.67788461538464, cost time:8
     numUpdates:887, size:2312259426, bytesPerUpdate:6942253.798798799, cost 
time:198
    15/04/21 14:27:26 INFO collection.ExternalAppendOnlyMap: Thread 51 spilling 
in-memory map of 3.0 GB to disk (1 time so far)
    15/04/21 14:27:26 INFO collection.ExternalAppendOnlyMap: 
/data11/yarnenv/local/usercache/spark/appcache/application_1426746631567_11745/spark-local-20150421142719-c001/30/temp_local_066af981-c2fc-4b70-a00e-110e23006fbc
    
    But in fact the file size is only 162K:
    $ ll -h 
/data11/yarnenv/local/usercache/spark/appcache/application_1426746631567_11745/spark-local-20150421142719-c001/30/temp_local_066af981-c2fc-4b70-a00e-110e23006fbc
    -rw-r----- 1 spark users 162K Apr 21 14:27 
/data11/yarnenv/local/usercache/spark/appcache/application_1426746631567_11745/spark-local-20150421142719-c001/30/temp_local_066af981-c2fc-4b70-a00e-110e23006fbc


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

    $ git pull https://github.com/shenh062326/spark my_change5

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

    https://github.com/apache/spark/pull/5608.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 #5608
    
----
commit 4c28e36f94cef254655d76ee9e290483943e4ba8
Author: Hong Shen <[email protected]>
Date:   2015-04-21T08:40:29Z

    Improve estimate the size of a large array

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to