You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Zhan Zhang <zz...@hortonworks.com> on 2014/09/04 01:43:36 UTC

Re: Running Wordcount on large file stucks and throws OOM exception

In word count, you don’t need much driver memory, unless you do collect, but it is not recommended.

val file = sc.textFile("hdfs://sandbox.hortonworks.com:8020/tmp/data")
val counts = file.flatMap(line => line.split(" ")).map(word => (word, 1)).reduceByKey(_ + _)
counts.saveAsTextFile("hdfs://sandbox.hortonworks.com:8020/tmp/wordcount")

Thanks.

Zhan Zhang

On Aug 26, 2014, at 12:35 AM, motte1988 <wi...@studserv.uni-leipzig.de> wrote:

> Hello,
> it's me again.
> Now I've got an explanation for the behaviour. It seems that the driver
> memory is not large enough to hold the whole result set of saveAsTextFile
> In-Memory. And then OOM occures. I test it with a filter-step that removes
> KV-pairs with WordCount smaller 100,000. So now the job finished
> successfully.
> But is this the desired behaviour of Spark, that available driver memory
> limits the size of the result set?
> Or is my explanation wrong?
> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Running-Wordcount-on-large-file-stucks-and-throws-OOM-exception-tp12747p12809.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
> 


-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.