Issue Details (XML | Word | Printable)

Key: HADOOP-2919
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Chris Douglas
Reporter: Chris Douglas
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

Create fewer copies of buffer data during sort/spill

Created: 01/Mar/08 02:02 AM   Updated: 08/Jul/09 04:52 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 0.17.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works 2919-0.patch 2008-03-01 02:03 AM Chris Douglas 53 kB
Text File Licensed for inclusion in ASF works 2919-1.patch 2008-03-07 01:51 AM Chris Douglas 57 kB
Text File Licensed for inclusion in ASF works 2919-2.patch 2008-03-10 07:01 AM Chris Douglas 60 kB
Text File Licensed for inclusion in ASF works 2919-3.patch 2008-03-10 05:58 PM Chris Douglas 60 kB
Text File Licensed for inclusion in ASF works 2919-4.patch 2008-03-13 10:28 PM Chris Douglas 60 kB
Text File Licensed for inclusion in ASF works 2919-5.patch 2008-03-19 03:00 AM Chris Douglas 61 kB
Text File Licensed for inclusion in ASF works 2919-6.patch 2008-03-20 01:23 AM Chris Douglas 62 kB
Text File Licensed for inclusion in ASF works 2919-7.patch 2008-03-26 10:27 PM Chris Douglas 62 kB
Issue Links:
Blocker
 
Incorporates
 

Resolution Date: 31/Mar/08 10:51 PM


 Description  « Hide
Currently, the sort/spill works as follows:

Let r be the number of partitions
For each call to collect(K,V) from map:

  • If buffers do not exist, allocate a new DataOutputBuffer to collect K,V bytes, allocate r buffers for collecting K,V offsets
  • Write K,V into buffer, noting offsets
  • Register offsets with associated partition buffer, allocating/copying accounting buffers if nesc
  • Calculate the total mem usage for buffer and all partition collectors by iterating over the collectors
  • If total mem usage is greater than half of io.sort.mb, then start a new thread to spill, blocking if another spill is in progress

For each spill (assuming no combiner):

  • Save references to our K,V byte buffer and accounting data, setting the former to null (will be recreated on the next call to collect(K,V))
  • Open a SequenceFile.Writer for this partition
  • Sort each partition separately (the current version of sort reuses, but still requires wrapping, indices in IntWritable objects)
  • Build a RawKeyValueIterator of sorted data for the partition
  • Deserialize each key and value and call SequenceFile::append(K,V) on the writer for this partition

There are a number of opportunities for reducing the number of copies, creations, and operations we perform in this stage, particularly since growing many of the buffers involved requires that we copy the existing data to the newly sized allocation.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order