You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by "octavian.ganea" <oc...@inf.ethz.ch> on 2014/09/20 11:08:41 UTC

Re: Avoid broacasting huge variables

Anyone ?

Is there any option to load data in each node before starting any
computation like it is the initialization of mappers in Hadoop ?



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Avoid-broacasting-huge-variables-tp14696p14726.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


Re: Avoid broacasting huge variables

Posted by Sean Owen <so...@cloudera.com>.
Why do you say it does not work? The singleton pattern works the same as
ever. It is not a pattern that involves Spark.
On Jan 18, 2015 12:57 PM, "octavian.ganea" <oc...@inf.ethz.ch>
wrote:

> The singleton hack works very different in spark 1.2.0 (it does not work if
> the program has multiple map-reduce jobs in the same program). I guess
> there
> should be an official documentation on how to have each machine/node do an
> init step locally before executing any other instructions (e.g. loading
> locally a very big object once at the begining that can be used in all
> further map jobs that will be assigned to that worker).
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/Avoid-broacasting-huge-variables-tp14696p21220.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
>
>

Re: Avoid broacasting huge variables

Posted by "octavian.ganea" <oc...@inf.ethz.ch>.
The singleton hack works very different in spark 1.2.0 (it does not work if
the program has multiple map-reduce jobs in the same program). I guess there
should be an official documentation on how to have each machine/node do an
init step locally before executing any other instructions (e.g. loading
locally a very big object once at the begining that can be used in all
further map jobs that will be assigned to that worker).



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Avoid-broacasting-huge-variables-tp14696p21220.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


Re: Avoid broacasting huge variables

Posted by "octavian.ganea" <oc...@inf.ethz.ch>.
Using mapPartitions and passing the big index object as a parameter to it was
not the best option, given the size of the big object and my RAM. The
workers died before starting the actual  computation. 

Anyway, creating a singleton object worked for me:

http://apache-spark-user-list.1001560.n3.nabble.com/How-to-share-a-NonSerializable-variable-among-tasks-in-the-same-worker-node-td11048.html#a11315

The big index was loaded once per each node.



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Avoid-broacasting-huge-variables-tp14696p14766.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


Re: Avoid broacasting huge variables

Posted by Sean Owen <so...@cloudera.com>.
Joining in a side conversation - yes this is the way to go. The data is
immutable so can be shared across all executors in one JVM in a singleton.

How to load it depends on where it is but there is nothing special to Spark
here. For instance if the file is on HDFS then you use HDFS APIs in some
class in your app that implements the Singleton pattern and then you use
this class in your function to access data.
We normally copy a file to the nodes and then explicitly load it in a
function passed to mapPartitions.

On 9/20/14, octavian.ganea <oc...@inf.ethz.ch> wrote:
> Anyone ?
>
> Is there any option to load data in each node before starting any
> computation like it is the initialization of mappers in Hadoop ?
>
>
>
> --
> View this message in context:
>
http://apache-spark-user-list.1001560.n3.nabble.com/Avoid-broacasting-huge-variables-tp14696p14726.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
>
>


--
--
Martin Goodson
@martingoodson

   -

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org

Re: Avoid broacasting huge variables

Posted by "octavian.ganea" <oc...@inf.ethz.ch>.
Hi Martin,

Thanks. That might be really useful. Can you give me a reference or an
example so that I understand how to do it ?  In my case, the nodes have
access to the same shared folder, so  I wouldn't have to copy the file
multiple times.



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Avoid-broacasting-huge-variables-tp14696p14729.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


Re: Avoid broacasting huge variables

Posted by Martin Goodson <ma...@gmail.com>.
We normally copy a file to the nodes and then explicitly load it in a
function passed to mapPartitions.

On 9/20/14, octavian.ganea <oc...@inf.ethz.ch> wrote:
> Anyone ?
>
> Is there any option to load data in each node before starting any
> computation like it is the initialization of mappers in Hadoop ?
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/Avoid-broacasting-huge-variables-tp14696p14726.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
>
>


-- 
--
Martin Goodson
@martingoodson

   -

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org