[ 
https://issues.apache.org/jira/browse/TEZ-3076?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15122231#comment-15122231
 ] 

Siddharth Seth commented on TEZ-3076:
-------------------------------------

I think it's better to separate the fastutil conversion to a separate patch. 
Any information on stability, correctness and speed of this library ?

- {code} completedInputSet = IntSets.synchronize(new 
IntOpenHashSet(numInputs)); {code}
I think this can be replaced with a BitSet - which would be more efficient than 
a map. Since this is Shuffle - it will receive 0/1 through maxInputs - a very 
limited set of values.

- The new DataInput implementation in InMemoryReader. This should throw an 
UnsupportedOperationException on all the methods which are not used - that'll 
help catch errors in case these are used in the future.

- MapOutput  - can we retain Type ? The overhead is a single reference - and 
this is used in almost all operations on this object.
- MapOutput - getDisk() can only be invoked once with this change. Javadocs 
need to call this out, and a check. Once again - should throw an Exception if 
it is invoked twice. Ideally, it'd be better to avoid such a change. Would 
setting up sub-classes as is done with FetchedInput help with saving memory and 
avoiding such special cases ? That would take care of the Type field as well.

The rest of the patch mostly looks good to me. Are you already running this 
patch on clusters ?

Not sure why DefaultSorter makes this worse ? It writes out a file to disk, but 
also sets the emptyPartitions flag - so the behaviour on the Shuffle side 
should be the same.

On the overall memory accounting problem (not this jira)
1. Should we start accounting for these overheads in the memory calculations ?
2. Put a hard limit on how many in-mem segments will be maintained, before 
they're aggregated to disk.
3. Eventually, get the In-Memory merge functional so that we don't maintain 
500K tiny buffers.


> Reduce merge memory overhead to support large number of in-memory mapoutputs
> ----------------------------------------------------------------------------
>
>                 Key: TEZ-3076
>                 URL: https://issues.apache.org/jira/browse/TEZ-3076
>             Project: Apache Tez
>          Issue Type: Bug
>            Reporter: Jonathan Eagles
>         Attachments: TEZ-3076.1.patch, TEZ-3076.2.patch, 
> TEZ-3076.3-branch-0.7.patch, TEZ-3076.3.patch
>
>
> Here is a typical stack trace, though sometimes it occurs with final merge 
> (since in-memory segment overhead > mapout overhead)
> Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
>       at org.apache.hadoop.io.DataInputBuffer.<init>(DataInputBuffer.java:68)
>       at 
> org.apache.tez.runtime.library.common.shuffle.orderedgrouped.InMemoryReader.<init>(InMemoryReader.java:42)
>       at 
> org.apache.tez.runtime.library.common.shuffle.orderedgrouped.MergeManager.createInMemorySegments(MergeManager.java:837)
>       at 
> org.apache.tez.runtime.library.common.shuffle.orderedgrouped.MergeManager.access$200(MergeManager.java:75)
>       at 
> org.apache.tez.runtime.library.common.shuffle.orderedgrouped.MergeManager$InMemoryMerger.merge(MergeManager.java:642)
>       at 
> org.apache.tez.runtime.library.common.shuffle.orderedgrouped.MergeThread.run(MergeThread.java:89)
> Details
>   around 1,000,000 spills were fetched committing around 100MB to the memory 
> budget (500,000 in memory). However, actual memory used for 500,000 segments 
> (50-350 bytes) is 480MB (expected 100-200MB)
> Mapout overhead is not budgeted
>   Each mapoutput needs around 50 bytes in addition to the data
> In Memory Segment overhead is not budgeted
>   Each In memory segment needs around 80 bytes in addition to the data
> Interaction with auto reduce parallelism
>   In this scenario, the upstream vertex was assuming 999 (pig's default hint 
> to use auto-reduce parallelism) downstream tasks. However, was reduced to 24 
> due to auto-reduce parallelism. This is putting 40 times more segments per 
> downstream task. Should auto-reduce parallelism consider merge overhead when 
> calculating parallelism?
> Legacy Default Sorter Empty Segment
>   Default sorter does not optimize empty segments like pipeline sorter does 
> and shows this symptom more.
> 2016-01-10 11:46:01,208 [INFO] [fetcher {scope_601} #7] 
> |orderedgrouped.MergeManager|: closeInMemoryFile -&gt; map-output of size: 
> 116, inMemoryMapOutputs.size() -&gt; 571831, commitMemory -&gt; 91503730, 
> usedMemory -&gt;91503846, mapOutput=MapOutput( AttemptIdentifier: 
> InputAttemptIdentifier [inputIdentifier=Input
> Identifier [inputIndex=763962], attemptNumber=0, 
> pathComponent=attempt_1444791925832_10460712_1_00_017766_0_10003, 
> spillType=0, spillId=-1], Type: MEMORY)
> 2016-01-10 11:46:01,208 [INFO] [fetcher {scope_601} #7] 
> |orderedgrouped.ShuffleScheduler|: Completed fetch for attempt: {763962, 0, 
> attempt_1444791925832_10460712_1_00_017766_0_10003} to MEMORY, csize=128, 
> dsize=116, EndTime=1452426361208, TimeTaken=0, Rate=0.00 MB/s
> 2016-01-10 11:46:01,209 [INFO] [fetcher {scope_601} #7] 
> |orderedgrouped.ShuffleScheduler|: scope_601: All inputs fetched for input 
> vertex : scope-601
> 2016-01-10 11:46:01,209 [INFO] [fetcher {scope_601} #7] 
> |orderedgrouped.ShuffleScheduler|: copy(1091856 (spillsFetched=1091856) of 
> 1091856. Transfer rate (CumulativeDataFetched/TimeSinceInputStarted)) 0.68 
> MB/s)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to