Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9173411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:35:02+00:00 2026-06-17T16:35:02+00:00

I have a data set that has approximately 1 billion data points. There are

  • 0

I have a data set that has approximately 1 billion data points. There are about 46 million unique data points I want to extract from this.

I want to use Hadoop to extract the unique values, but keep getting “Out of Memory” and Java heap size errors on Hadoop – at the same time, I am able to run this fairly easily on a single box using a Python Set (hashtable, if you will.)

I am using a fairly simple algorithm to extract these unique values: I am parsing the 1 billion lines in my map and outputting lines that look like this:

UniqValueCount:I    a
UniqValueCount:I    a
UniqValueCount:I    b
UniqValueCount:I    c
UniqValueCount:I    c
UniqValueCount:I    d

and then running the “aggregate” reducer to get the results, which should look like this for the above data set:

I   4

This works well for a small set of values, but when I run this for the 1 billion data points (which have 46 million keys, as I mentioned) the job fails.

I’m running this on Amazon’s Elastic Map Reduce, and even if I use six m2.4xlarge nodes (their maximum memory nodes at 68.4 GB each) the job fails with the “out of memory” errors.

But I am able to extract the unique values using a Python code with a Set data structure (hash table) on one single m1.large (a much smaller box with 8 GB memory). I am confused that the Hadoop job fails since 46 million uniques should not take up that much memory.

What could be going wrong? Am I using the UniqValueCount wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:35:03+00:00Added an answer on June 17, 2026 at 4:35 pm

    You’re probably getting the memory error in the shuffle, remember that Hadoop sorts the keys before starting the reducers. Sort itself is not necessary for most apps, but Hadoop uses this as a way to aggregate all value belonging to a key.

    For your example, your mappers will end up writing a lot of times the same values, while you only care about how many uniques you have for a given key. Here is what you’re doing right now:

    Mapper output:
    I -> a
    I -> a
    I -> a
    I -> a
    I -> b
    I -> a
    I -> b
    
    Reducer input:
    I -> [a, a, a, a, b, a, b]
    
    Reducer output:
    I -> 2
    

    But you really don’t need to write 5*a or 2*b in this case, 1 time would be enough since you only care about uniques. So instead of counting the uniques in the reducer, you could directly reduce a lot of overhead by making sure you only send each value once:

    Mapper output:
    I -> a
    I -> b
    
    Reducer input:
    I -> [a, b]
    
    Reducer output:
    I -> 2
    

    This would effectively reduce the network bandwidth, and the shuffle will be much simpler since there will be less keys to sort.

    You could do this 2 ways:

    • Add a combiner in your job that will run just after the mapper but before the reducer, and will only keep uniques before sending to the reducer.
    • Modify your mapper to keep a mapping of what you already sent, and not send if you’ve already sent this mapping before.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of data that has two points; watts and a time
I have a large data set that I'm working with in excel. About 1000+
I have a data set file that has 3 columns in it. 0 0
I have a certain set of data that has a very certain spacing that
I have a data entry form that has remote validation set up to check
I have a data-set that has four columns [X Y Z C]. I would
So, I have this file that has data set up like this: Bob 5
I have a data set that has two tab delimited columns that I plot
So I have a google line chart visualization with a data set that has
I have a set of approximately 1.1 million unique IDs and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.