You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Yanzhe Chen <ya...@gmail.com> on 2014/04/15 19:03:57 UTC
Why these operations are slower than the equivalent on Hadoop?
Hi all,
As a previous thread, I am asking how to implement a divide-and-conquer algorithm (skyline) in Spark.
Here is my current solution:
val data = sc.textFile(…).map(line => line.split(“,”).map(_.toDouble))
val result = data.mapPartitions(points => skyline(points.toArray).iterator).coalesce(1, true)
.mapPartitions(points => skyline(points.toArray).iterator).collect()
where skyline is a local algorithm to compute the results:
def skyline(points: Array[Point]) : Array[Point]
Basically, I find this implement runs slower than the corresponding Hadoop version (the identity map phase plus local skyline for both combine and reduce phases).
Below are my questions:
1. Why this implementation is much slower than the Hadoop one?
I can find two possible reasons: one is the shuffle overhead in coalesce, another is calling the toArray and iterator repeatedly when invoking local skyline algorithm. But I am not sure which one is true.
2. One observation is that while Hadoop version almost used up all the CPU resources during execution, the CPU seems not that hot on Spark. Is that a clue to prove that the shuffling might be the real bottleneck?
3. Is there any difference between coalesce(1, true) and reparation? It seems that both opeartions need shuffling data. What’s the proper situations using the coalesce method?
4. More generally, I am trying to implementing some core geometry computation operators on Spark (like skyline, convex hull etc). In my understanding, since Spark is more capable of handling iterative computations on dataset, the above solution apparently doesn’t exploit what Spark is good at. Any comments on how to do geometry computations on Spark (if it is possible) ?
Thanks for any insight.
Yanzhe
Re: Why these operations are slower than the equivalent on
Hadoop?
Posted by Yanzhe Chen <ya...@gmail.com>.
Hi Eugen,
Sorry if I haven’t catch your point. In the second example,
val result = data.mapPartitions(points => skyline(points.toArray).iterator)
.reduce {
case (left, right) =>
skyline(left ++ right)
}
In my understanding, if the data is type RDD<Point>, then both left and right in reduce case is type Point, so why skyline will run on two partitions rather than two single points?
Besides, the definition of my skyline function is skyline(points: Array[Point]) : Array[Point].
Thanks,
Yanzhe
On Wednesday, April 16, 2014 at 2:43 PM, Eugen Cepoi wrote:
> Yes, the second example does that. It transforms all the points of a partition into a single element the skyline, thus reduce will run on the skyline of two partitions and not on single points.
> Le 16 avr. 2014 06:47, "Yanzhe Chen" <yanzhe.cn@gmail.com (mailto:yanzhe.cn@gmail.com)> a écrit :
> > Eugen,
> >
> > Thanks for your tip and I do want to merge the result of a partition with another one but I am still not quite clear how to do it.
> >
> > Say the original data rdd has 32 partitions and since mapPartitions won’t change the number of partitions, it will remain 32 partitions which each contains the partial skyline of points in its partition. Now I want to merge those 32 partitions to generate a new skyline. It will be better if I can use reduce to merge each two of them (than just collect them in to one), but I think simply calling reduce method on the rdd won’t work because it reduce the data at the granularity of point rather than the partition results (which is the collection of points). So is there a way to reduce the data at the granularity of partitions?
> >
> > Thanks,
> >
> > Yanzhe
> >
> > On Wednesday, April 16, 2014 at 2:24 AM, Eugen Cepoi wrote:
> >
> > > It depends on your algorithm but I guess that you probably should use reduce (the code probably doesn't compile but it shows you the idea).
> > >
> > > val result = data.reduce { case (left, right) =>
> > > skyline(left ++ right)
> > > }
> > >
> > > Or in the case you want to merge the result of a partition with another one you could do:
> > >
> > > val result = data.mapPartitions { points =>
> > >
> > > // transforms all the partition into a single element, but this may incur some other problems, especially if you use Kryo serialization...
> > > Seq(skyline(points.toArray))
> > > }.reduce { case (left, right) =>
> > >
> > > skyline(left ++ right)
> > > }
> > >
> > >
> > >
> > >
> > > 2014-04-15 19:37 GMT+02:00 Cheng Lian <lian.cs.zju@gmail.com (mailto:lian.cs.zju@gmail.com)>:
> > > >
> > > > Your Spark solution first reduces partial results into a single partition, computes the final result, and then collects to the driver side. This involves a shuffle and two waves of network traffic. Instead, you can directly collect partial results to the driver and then computes the final results on driver side:
> > > >
> > > > val data = sc.textFile(...).map(line => line.split(",").map(_.toDouble)) val partialResults = data.mapPartitions(points => skyline(points.toArray).iterator).collect() val results = skyline(partialResults)
> > > >
> > > > On Wed, Apr 16, 2014 at 1:03 AM, Yanzhe Chen <yanzhe.cn@gmail.com (mailto:yanzhe.cn@gmail.com)> wrote:
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > > Hi all,
> > > > >
> > > > > As a previous thread, I am asking how to implement a divide-and-conquer algorithm (skyline) in Spark.
> > > > > Here is my current solution:
> > > > >
> > > > > val data = sc.textFile(…).map(line => line.split(“,”).map(_.toDouble))
> > > > >
> > > > > val result = data.mapPartitions(points => skyline(points.toArray).iterator).coalesce(1, true)
> > > > > .mapPartitions(points => skyline(points.toArray).iterator).collect()
> > > > >
> > > > > where skyline is a local algorithm to compute the results:
> > > > >
> > > > > def skyline(points: Array[Point]) : Array[Point]
> > > > >
> > > > > Basically, I find this implement runs slower than the corresponding Hadoop version (the identity map phase plus local skyline for both combine and reduce phases).
> > > > >
> > > > > Below are my questions:
> > > > >
> > > > > 1. Why this implementation is much slower than the Hadoop one?
> > > > >
> > > > > I can find two possible reasons: one is the shuffle overhead in coalesce, another is calling the toArray and iterator repeatedly when invoking local skyline algorithm. But I am not sure which one is true.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I haven’t seen your Hadoop version. But if this assumption is right, the above version should help.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > >
> > > > > 2. One observation is that while Hadoop version almost used up all the CPU resources during execution, the CPU seems not that hot on Spark. Is that a clue to prove that the shuffling might be the real bottleneck?
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > How many parallel tasks are there when running your Spark code? I doubt tasks are queued and run sequentially.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > >
> > > > > 3. Is there any difference between coalesce(1, true) and reparation? It seems that both opeartions need shuffling data. What’s the proper situations using the coalesce method?
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > repartition(n) is just an alias of coalesce(n, true), so yes, they both involve data shuffling. coalesce can be used to shrink partition number when dataset size shrinks dramatically after operations like filter. Say you have an RDD containing 1TB of data with 100 partitions, after a .filter(...) call, only 20GB data left, then you may want to coalesce to 2 partitions rather than 100.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > >
> > > > > 4. More generally, I am trying to implementing some core geometry computation operators on Spark (like skyline, convex hull etc). In my understanding, since Spark is more capable of handling iterative computations on dataset, the above solution apparently doesn’t exploit what Spark is good at. Any comments on how to do geometry computations on Spark (if it is possible) ?
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Although Spark is good at iterative algorithms, it also performs better in batch computing due to much lower scheduling overhead and thread level parallelism. Theoretically, you can always accelerate your MapReduce job by rewriting it in Spark.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > >
> > > > > Thanks for any insight.
> > > > >
> > > > > Yanzhe
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
Re: Why these operations are slower than the equivalent on Hadoop?
Posted by Cheng Lian <li...@gmail.com>.
Hmm… The good part of reduce is that it performs local combining within a
single partition automatically, but since you turned each partition into a
single-value one, local combining is not applicable, and reduce simply
degrades to collect and then perform a skyline over all collected partial
results on the driver side.
On Wed, Apr 16, 2014 at 2:43 PM, Eugen Cepoi <ce...@gmail.com> wrote:
> Yes, the second example does that. It transforms all the points of a
> partition into a single element the skyline, thus reduce will run on the
> skyline of two partitions and not on single points.
> Le 16 avr. 2014 06:47, "Yanzhe Chen" <ya...@gmail.com> a écrit :
>
> Eugen,
>>
>> Thanks for your tip and I do want to merge the result of a partition with
>> another one but I am still not quite clear how to do it.
>>
>> Say the original data rdd has 32 partitions and since mapPartitionswon’t change the number of partitions, it will remain 32 partitions which
>> each contains the partial skyline of points in its partition. Now I want to
>> merge those 32 partitions to generate a new skyline. It will be better if I
>> can use reduce to merge each two of them (than just collect them in to
>> one), but I think simply calling reduce method on the rdd won’t work
>> because it reduce the data at the granularity of point rather than the
>> partition results (which is the collection of points). So is there a way to
>> reduce the data at the granularity of partitions?
>>
>> Thanks,
>>
>> Yanzhe
>>
>> On Wednesday, April 16, 2014 at 2:24 AM, Eugen Cepoi wrote:
>>
>> It depends on your algorithm but I guess that you probably should use
>> reduce (the code probably doesn't compile but it shows you the idea).
>>
>> val result = data.reduce { case (left, right) =>
>> skyline(left ++ right)
>> }
>>
>> Or in the case you want to merge the result of a partition with another
>> one you could do:
>>
>> val result = data.mapPartitions { points =>
>>
>> // transforms all the partition into a single
>> element, but this may incur some other problems, especially if you use Kryo
>> serialization...
>> *Seq(skyline*(points.toArray))
>> }.reduce { case (left, right) =>
>>
>> skyline(left ++ right)
>> }
>>
>>
>>
>>
>> 2014-04-15 19:37 GMT+02:00 Cheng Lian <li...@gmail.com>:
>>
>> Your Spark solution first reduces partial results into a single
>> partition, computes the final result, and then collects to the driver side.
>> This involves a shuffle and two waves of network traffic. Instead, you can
>> directly collect partial results to the driver and then computes the final
>> results on driver side:
>>
>> val data = sc.textFile(...).map(line => line.split(",").map(_.toDouble))val partialResults = data.mapPartitions(points => skyline(points.toArray).iterator).collect()val results = skyline(partialResults)
>>
>> On Wed, Apr 16, 2014 at 1:03 AM, Yanzhe Chen <ya...@gmail.com> wrote:
>>
>> Hi all,
>>
>> As a previous thread, I am asking how to implement a divide-and-conquer
>> algorithm (skyline) in Spark.
>> Here is my current solution:
>>
>> val data = sc.textFile(…).map(line => line.split(“,”).map(_.toDouble))
>>
>> val result = data.mapPartitions(points => *skyline*(points.toArray).iterator).coalesce(1,
>> true)
>> .mapPartitions(points => *skyline*
>> (points.toArray).iterator).collect()
>>
>> where skyline is a local algorithm to compute the results:
>>
>> def *skyline*(points: Array[Point]) : Array[Point]
>>
>> Basically, I find this implement runs slower than the corresponding
>> Hadoop version (the identity map phase plus local skyline for both combine
>> and reduce phases).
>>
>> Below are my questions:
>>
>> 1. Why this implementation is much slower than the Hadoop one?
>>
>> I can find two possible reasons: one is the shuffle overhead in coalesce,
>> another is calling the toArray and iterator repeatedly when invoking
>> local skyline algorithm. But I am not sure which one is true.
>>
>> I haven’t seen your Hadoop version. But if this assumption is right, the
>> above version should help.
>>
>>
>> 2. One observation is that while Hadoop version almost used up all the
>> CPU resources during execution, the CPU seems not that hot on Spark. Is
>> that a clue to prove that the shuffling might be the real bottleneck?
>>
>> How many parallel tasks are there when running your Spark code? I doubt
>> tasks are queued and run sequentially.
>>
>>
>> 3. Is there any difference between coalesce(1, true) and reparation? It
>> seems that both opeartions need shuffling data. What’s the proper
>> situations using the coalesce method?
>>
>> repartition(n) is just an alias of coalesce(n, true), so yes, they both
>> involve data shuffling. coalesce can be used to shrink partition number
>> when dataset size shrinks dramatically after operations like filter. Say
>> you have an RDD containing 1TB of data with 100 partitions, after a
>> .filter(...) call, only 20GB data left, then you may want to coalesce to
>> 2 partitions rather than 100.
>>
>>
>> 4. More generally, I am trying to implementing some core geometry
>> computation operators on Spark (like skyline, convex hull etc). In my
>> understanding, since Spark is more capable of handling iterative
>> computations on dataset, the above solution apparently doesn’t exploit what
>> Spark is good at. Any comments on how to do geometry computations on Spark
>> (if it is possible) ?
>>
>> Although Spark is good at iterative algorithms, it also performs better
>> in batch computing due to much lower scheduling overhead and thread level
>> parallelism. Theoretically, you can always accelerate your MapReduce job by
>> rewriting it in Spark.
>>
>>
>> Thanks for any insight.
>>
>> Yanzhe
>>
>>
>>
>>
Re: Why these operations are slower than the equivalent on Hadoop?
Posted by Eugen Cepoi <ce...@gmail.com>.
Yes, the second example does that. It transforms all the points of a
partition into a single element the skyline, thus reduce will run on the
skyline of two partitions and not on single points.
Le 16 avr. 2014 06:47, "Yanzhe Chen" <ya...@gmail.com> a écrit :
> Eugen,
>
> Thanks for your tip and I do want to merge the result of a partition with
> another one but I am still not quite clear how to do it.
>
> Say the original data rdd has 32 partitions and since mapPartitions won’t
> change the number of partitions, it will remain 32 partitions which each
> contains the partial skyline of points in its partition. Now I want to
> merge those 32 partitions to generate a new skyline. It will be better if I
> can use reduce to merge each two of them (than just collect them in to
> one), but I think simply calling reduce method on the rdd won’t work
> because it reduce the data at the granularity of point rather than the
> partition results (which is the collection of points). So is there a way to
> reduce the data at the granularity of partitions?
>
> Thanks,
>
> Yanzhe
>
> On Wednesday, April 16, 2014 at 2:24 AM, Eugen Cepoi wrote:
>
> It depends on your algorithm but I guess that you probably should use
> reduce (the code probably doesn't compile but it shows you the idea).
>
> val result = data.reduce { case (left, right) =>
> skyline(left ++ right)
> }
>
> Or in the case you want to merge the result of a partition with another
> one you could do:
>
> val result = data.mapPartitions { points =>
>
> // transforms all the partition into a single element,
> but this may incur some other problems, especially if you use Kryo
> serialization...
> *Seq(skyline*(points.toArray))
> }.reduce { case (left, right) =>
>
> skyline(left ++ right)
> }
>
>
>
>
> 2014-04-15 19:37 GMT+02:00 Cheng Lian <li...@gmail.com>:
>
> Your Spark solution first reduces partial results into a single partition,
> computes the final result, and then collects to the driver side. This
> involves a shuffle and two waves of network traffic. Instead, you can
> directly collect partial results to the driver and then computes the final
> results on driver side:
>
> val data = sc.textFile(...).map(line => line.split(",").map(_.toDouble))val partialResults = data.mapPartitions(points => skyline(points.toArray).iterator).collect()val results = skyline(partialResults)
>
> On Wed, Apr 16, 2014 at 1:03 AM, Yanzhe Chen <ya...@gmail.com> wrote:
>
> Hi all,
>
> As a previous thread, I am asking how to implement a divide-and-conquer
> algorithm (skyline) in Spark.
> Here is my current solution:
>
> val data = sc.textFile(…).map(line => line.split(“,”).map(_.toDouble))
>
> val result = data.mapPartitions(points => *skyline*(points.toArray).iterator).coalesce(1,
> true)
> .mapPartitions(points => *skyline*
> (points.toArray).iterator).collect()
>
> where skyline is a local algorithm to compute the results:
>
> def *skyline*(points: Array[Point]) : Array[Point]
>
> Basically, I find this implement runs slower than the corresponding Hadoop
> version (the identity map phase plus local skyline for both combine and
> reduce phases).
>
> Below are my questions:
>
> 1. Why this implementation is much slower than the Hadoop one?
>
> I can find two possible reasons: one is the shuffle overhead in coalesce,
> another is calling the toArray and iterator repeatedly when invoking
> local skyline algorithm. But I am not sure which one is true.
>
> I haven’t seen your Hadoop version. But if this assumption is right, the
> above version should help.
>
>
> 2. One observation is that while Hadoop version almost used up all the CPU
> resources during execution, the CPU seems not that hot on Spark. Is that a
> clue to prove that the shuffling might be the real bottleneck?
>
> How many parallel tasks are there when running your Spark code? I doubt
> tasks are queued and run sequentially.
>
>
> 3. Is there any difference between coalesce(1, true) and reparation? It
> seems that both opeartions need shuffling data. What’s the proper
> situations using the coalesce method?
>
> repartition(n) is just an alias of coalesce(n, true), so yes, they both
> involve data shuffling. coalesce can be used to shrink partition number
> when dataset size shrinks dramatically after operations like filter. Say
> you have an RDD containing 1TB of data with 100 partitions, after a
> .filter(...) call, only 20GB data left, then you may want to coalesce to
> 2 partitions rather than 100.
>
>
> 4. More generally, I am trying to implementing some core geometry
> computation operators on Spark (like skyline, convex hull etc). In my
> understanding, since Spark is more capable of handling iterative
> computations on dataset, the above solution apparently doesn’t exploit what
> Spark is good at. Any comments on how to do geometry computations on Spark
> (if it is possible) ?
>
> Although Spark is good at iterative algorithms, it also performs better in
> batch computing due to much lower scheduling overhead and thread level
> parallelism. Theoretically, you can always accelerate your MapReduce job by
> rewriting it in Spark.
>
>
> Thanks for any insight.
>
> Yanzhe
>
>
>
>
Re: Why these operations are slower than the equivalent on
Hadoop?
Posted by Yanzhe Chen <ya...@gmail.com>.
Eugen,
Thanks for your tip and I do want to merge the result of a partition with another one but I am still not quite clear how to do it.
Say the original data rdd has 32 partitions and since mapPartitions won’t change the number of partitions, it will remain 32 partitions which each contains the partial skyline of points in its partition. Now I want to merge those 32 partitions to generate a new skyline. It will be better if I can use reduce to merge each two of them (than just collect them in to one), but I think simply calling reduce method on the rdd won’t work because it reduce the data at the granularity of point rather than the partition results (which is the collection of points). So is there a way to reduce the data at the granularity of partitions?
Thanks,
Yanzhe
On Wednesday, April 16, 2014 at 2:24 AM, Eugen Cepoi wrote:
> It depends on your algorithm but I guess that you probably should use reduce (the code probably doesn't compile but it shows you the idea).
>
> val result = data.reduce { case (left, right) =>
> skyline(left ++ right)
> }
>
> Or in the case you want to merge the result of a partition with another one you could do:
>
> val result = data.mapPartitions { points =>
>
> // transforms all the partition into a single element, but this may incur some other problems, especially if you use Kryo serialization...
> Seq(skyline(points.toArray))
> }.reduce { case (left, right) =>
>
> skyline(left ++ right)
> }
>
>
>
>
> 2014-04-15 19:37 GMT+02:00 Cheng Lian <lian.cs.zju@gmail.com (mailto:lian.cs.zju@gmail.com)>:
> >
> > Your Spark solution first reduces partial results into a single partition, computes the final result, and then collects to the driver side. This involves a shuffle and two waves of network traffic. Instead, you can directly collect partial results to the driver and then computes the final results on driver side:
> >
> > val data = sc.textFile(...).map(line => line.split(",").map(_.toDouble)) val partialResults = data.mapPartitions(points => skyline(points.toArray).iterator).collect() val results = skyline(partialResults)
> >
> > On Wed, Apr 16, 2014 at 1:03 AM, Yanzhe Chen <yanzhe.cn@gmail.com (mailto:yanzhe.cn@gmail.com)> wrote:
> >
> >
> >
> >
> >
> > > Hi all,
> > >
> > > As a previous thread, I am asking how to implement a divide-and-conquer algorithm (skyline) in Spark.
> > > Here is my current solution:
> > >
> > > val data = sc.textFile(…).map(line => line.split(“,”).map(_.toDouble))
> > >
> > > val result = data.mapPartitions(points => skyline(points.toArray).iterator).coalesce(1, true)
> > > .mapPartitions(points => skyline(points.toArray).iterator).collect()
> > >
> > > where skyline is a local algorithm to compute the results:
> > >
> > > def skyline(points: Array[Point]) : Array[Point]
> > >
> > > Basically, I find this implement runs slower than the corresponding Hadoop version (the identity map phase plus local skyline for both combine and reduce phases).
> > >
> > > Below are my questions:
> > >
> > > 1. Why this implementation is much slower than the Hadoop one?
> > >
> > > I can find two possible reasons: one is the shuffle overhead in coalesce, another is calling the toArray and iterator repeatedly when invoking local skyline algorithm. But I am not sure which one is true.
> >
> >
> >
> >
> >
> >
> >
> > I haven’t seen your Hadoop version. But if this assumption is right, the above version should help.
> >
> >
> >
> >
> >
> > >
> > > 2. One observation is that while Hadoop version almost used up all the CPU resources during execution, the CPU seems not that hot on Spark. Is that a clue to prove that the shuffling might be the real bottleneck?
> >
> >
> >
> >
> >
> >
> >
> > How many parallel tasks are there when running your Spark code? I doubt tasks are queued and run sequentially.
> >
> >
> >
> >
> >
> > >
> > > 3. Is there any difference between coalesce(1, true) and reparation? It seems that both opeartions need shuffling data. What’s the proper situations using the coalesce method?
> >
> >
> >
> >
> >
> >
> >
> > repartition(n) is just an alias of coalesce(n, true), so yes, they both involve data shuffling. coalesce can be used to shrink partition number when dataset size shrinks dramatically after operations like filter. Say you have an RDD containing 1TB of data with 100 partitions, after a .filter(...) call, only 20GB data left, then you may want to coalesce to 2 partitions rather than 100.
> >
> >
> >
> >
> >
> > >
> > > 4. More generally, I am trying to implementing some core geometry computation operators on Spark (like skyline, convex hull etc). In my understanding, since Spark is more capable of handling iterative computations on dataset, the above solution apparently doesn’t exploit what Spark is good at. Any comments on how to do geometry computations on Spark (if it is possible) ?
> >
> >
> >
> >
> >
> >
> >
> > Although Spark is good at iterative algorithms, it also performs better in batch computing due to much lower scheduling overhead and thread level parallelism. Theoretically, you can always accelerate your MapReduce job by rewriting it in Spark.
> >
> >
> >
> >
> >
> > >
> > > Thanks for any insight.
> > >
> > > Yanzhe
> > >
> >
> >
> >
> >
> >
> >
> >
>
>
>
Re: Why these operations are slower than the equivalent on Hadoop?
Posted by Eugen Cepoi <ce...@gmail.com>.
It depends on your algorithm but I guess that you probably should use
reduce (the code probably doesn't compile but it shows you the idea).
val result = data.reduce { case (left, right) =>
skyline(left ++ right)
}
Or in the case you want to merge the result of a partition with another one
you could do:
val result = data.mapPartitions { points =>
// transforms all the partition into a single element,
but this may incur some other problems, especially if you use Kryo
serialization...
*Seq(skyline*(points.toArray))
}.reduce { case (left, right) =>
skyline(left ++ right)
}
2014-04-15 19:37 GMT+02:00 Cheng Lian <li...@gmail.com>:
> Your Spark solution first reduces partial results into a single partition,
> computes the final result, and then collects to the driver side. This
> involves a shuffle and two waves of network traffic. Instead, you can
> directly collect partial results to the driver and then computes the final
> results on driver side:
>
> val data = sc.textFile(...).map(line => line.split(",").map(_.toDouble))val partialResults = data.mapPartitions(points => skyline(points.toArray).iterator).collect()val results = skyline(partialResults)
>
> On Wed, Apr 16, 2014 at 1:03 AM, Yanzhe Chen <ya...@gmail.com> wrote:
>
> Hi all,
>>
>> As a previous thread, I am asking how to implement a divide-and-conquer
>> algorithm (skyline) in Spark.
>> Here is my current solution:
>>
>> val data = sc.textFile(…).map(line => line.split(“,”).map(_.toDouble))
>>
>> val result = data.mapPartitions(points => *skyline*(points.toArray).iterator).coalesce(1,
>> true)
>> .mapPartitions(points => *skyline*
>> (points.toArray).iterator).collect()
>>
>> where skyline is a local algorithm to compute the results:
>>
>> def *skyline*(points: Array[Point]) : Array[Point]
>>
>> Basically, I find this implement runs slower than the corresponding
>> Hadoop version (the identity map phase plus local skyline for both combine
>> and reduce phases).
>>
>> Below are my questions:
>>
>> 1. Why this implementation is much slower than the Hadoop one?
>>
>> I can find two possible reasons: one is the shuffle overhead in coalesce,
>> another is calling the toArray and iterator repeatedly when invoking
>> local skyline algorithm. But I am not sure which one is true.
>>
> I haven’t seen your Hadoop version. But if this assumption is right, the
> above version should help.
>
>
>> 2. One observation is that while Hadoop version almost used up all the
>> CPU resources during execution, the CPU seems not that hot on Spark. Is
>> that a clue to prove that the shuffling might be the real bottleneck?
>>
> How many parallel tasks are there when running your Spark code? I doubt
> tasks are queued and run sequentially.
>
>
>> 3. Is there any difference between coalesce(1, true) and reparation? It
>> seems that both opeartions need shuffling data. What’s the proper
>> situations using the coalesce method?
>>
> repartition(n) is just an alias of coalesce(n, true), so yes, they both
> involve data shuffling. coalesce can be used to shrink partition number
> when dataset size shrinks dramatically after operations like filter. Say
> you have an RDD containing 1TB of data with 100 partitions, after a
> .filter(...) call, only 20GB data left, then you may want to coalesce to
> 2 partitions rather than 100.
>
>
>> 4. More generally, I am trying to implementing some core geometry
>> computation operators on Spark (like skyline, convex hull etc). In my
>> understanding, since Spark is more capable of handling iterative
>> computations on dataset, the above solution apparently doesn’t exploit what
>> Spark is good at. Any comments on how to do geometry computations on Spark
>> (if it is possible) ?
>>
> Although Spark is good at iterative algorithms, it also performs better in
> batch computing due to much lower scheduling overhead and thread level
> parallelism. Theoretically, you can always accelerate your MapReduce job by
> rewriting it in Spark.
>
>
>> Thanks for any insight.
>>
>> Yanzhe
>>
>>
Re: Why these operations are slower than the equivalent on Hadoop?
Posted by Eugen Cepoi <ce...@gmail.com>.
Hi Yanzhe,
Indeed the reduce here won't help, as Cheng stated, it would behave as a
collect (maybe worse).
Maybe you can try something like following:
var data: RDD[Array[Double]] = sc.textFile(args(1)).map(line =>
line.split(",").map(_.toDouble))
var size = data.partitions.size
while (size > 1) {
size = size/2 + size%2
data = data.mapPartitions(points =>
skyline(points.toArray).iterator).coalesce(size, true)
}
// the result is already computed, no need to apply skyline again
val output = data.collect
The idea being to use the coalesce method to merge partitions, however the
points from one partition would end up splitted accross the new partitions
(but maybe in your case the algorithm still works?)
Eugen
2014-04-16 10:07 GMT+02:00 Yanzhe Chen <ya...@gmail.com>:
> Hi Cheng,
>
> Thanks for your help! I have pasted my Spark and Hadoop skyline code on
> Github:
>
> Spark version: https://gist.github.com/yanzhe-chen/10828117
> Hadoop version: https://gist.github.com/yanzhe-chen/10828988
>
> Best,
> Yanzhe
>
> On Wednesday, April 16, 2014 at 3:43 PM, Cheng Lian wrote:
>
> On Wed, Apr 16, 2014 at 12:08 PM, Yanzhe Chen <ya...@gmail.com> wrote:
>
> …
>
> Clusters will not be fully utilized unless you set the level of
> parallelism for each operation high enough. Spark automatically sets the
> number of “map” tasks to run on each file according to its size (though you
> can control it through optional parameters to SparkContext.textFile,
> etc),
>
> Does this mean if I call SparkContext.textFile(path, minSplit), then each
> file will be split into *minSplit* partitions? And if it is, say my input
> has 16 files, and minSplit is set to 2, does that mean Spark will generate
> 32 tasks if I call mapPartitions?
>
> Things are a bit more complicated. minSplit is just a hint of partition
> numbers, it just specifies a minimum partition number. The actual partition
> number is decided by the underlying Hadoop InputFormat, and may be larger
> than minSplit (e.g. when size of individual input file is larger than an
> HDFS block). If you want to set partition number to n precisely, you may
> try this:
>
> sc.textFile(path, n).coalesce(n)
>
> and for distributed “reduce” operations, such as groupByKey and
> reduceByKey, it uses the largest parent RDD’s number of partitions. You
> can pass the level of parallelism as a second argument (see the
> spark.PairRDDFunctions<https://spark.apache.org/docs/0.9.0/api/core/index.html#org.apache.spark.rdd.PairRDDFunctions> documentation),
>
>
> It seems that currently I don’t use any group operations so does this mean
> there are no distributed “reduce” operations in my code? Does collect
> operation belongs to “reduce” operation?
>
> The essence of “distributed reduce” operation is that those operations
> involve data shuffling. So collect isn’t a “distributed reduce”
> operation, it’s an action (which triggers a job). It just collects data
> from executors to the driver. And yes, your code doesn’t have any
> distributed “reduce” operation.
>
> or set the config property spark.default.parallelism to change the
> default. In general, we recommend 2-3 tasks per CPU core in your cluster.
>
> If minSplit in SparkContext.textFile specify the parallelism on map side
> and PairRDDFunctions’s second argument controls the parallelism of reduce
> side. What spark.default.parallelism used for?
>
> spark.default.parallelism is used to decide RDD partition number when you
> don’t specify any.
>
>
> Besides, I pasted the LOG of my driver program here and can you tell the
> whether the tasks are queued and run sequentially?
>
> From the log, I can see 32 tasks run in parallel. I can’t give any further
> suggestions without more details now. Would you please paste simplified but
> complete version of your Spark and Hadoop skyline code to GitHub gist?
>
>
> I have a four-node cluster (brick10 - brick13) and each with 16-core and
> 64GB. And the parameters in the Tuning Guide are all set to default (
> spark.default.parallelism = 8 and minSplit = 2). The input data is 1GB
> random generated points.
>
> 14/04/16 12:01:46 INFO SecurityManager: SecurityManager, is authentication
> enabled: false are ui acls enabled: false users with view permissions:
> Set(yanzhe)
> 14/04/16 12:01:47 INFO Slf4jLogger: Slf4jLogger started
> 14/04/16 12:01:47 INFO Remoting: Starting remoting
> 14/04/16 12:01:47 INFO Remoting: Remoting started; listening on addresses
> :[akka.tcp://spark@brick5.ipads-lab.se.sjtu.edu.cn:49364]
> 14/04/16 12:01:47 INFO Remoting: Remoting now listens on addresses:
> [akka.tcp://spark@brick5.ipads-lab.se.sjtu.edu.cn:49364]
> 14/04/16 12:01:47 INFO SparkEnv: Registering BlockManagerMaster
> 14/04/16 12:01:47 INFO DiskBlockManager: Created local directory at
> /tmp/spark-local-20140416120147-d6a9
> 14/04/16 12:01:47 INFO MemoryStore: MemoryStore started with capacity
> 294.9 MB.
> 14/04/16 12:01:48 INFO ConnectionManager: Bound socket to port 44635 with
> id = ConnectionManagerId(brick5.ipads-lab.se.sjtu.edu.cn,44635)
> 14/04/16 12:01:48 INFO BlockManagerMaster: Trying to register BlockManager
> 14/04/16 12:01:48 INFO BlockManagerInfo: Registering block manager
> brick5.ipads-lab.se.sjtu.edu.cn:44635 with 294.9 MB RAM
> 14/04/16 12:01:48 INFO BlockManagerMaster: Registered BlockManager
> 14/04/16 12:01:48 INFO HttpServer: Starting HTTP Server
> 14/04/16 12:01:48 INFO HttpBroadcast: Broadcast server started at
> http://192.168.12.184:54396
> 14/04/16 12:01:48 INFO SparkEnv: Registering MapOutputTracker
> 14/04/16 12:01:48 INFO HttpFileServer: HTTP File server directory is
> /tmp/spark-75415972-fc25-4f12-a337-79abce06c085
> 14/04/16 12:01:48 INFO HttpServer: Starting HTTP Server
> 14/04/16 12:01:48 INFO SparkUI: Started Spark Web UI at
> http://brick5.ipads-lab.se.sjtu.edu.cn:4040
> 14/04/16 12:01:49 INFO SparkContext: Added JAR
> /home/yanzhe/gislib_2.10-0.1.jar at
> http://192.168.12.184:54005/jars/gislib_2.10-0.1.jar with timestamp
> 1397620909025
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Connecting to master
> spark://brick5:7077...
> 14/04/16 12:01:49 INFO MemoryStore: ensureFreeSpace(56397) called with
> curMem=0, maxMem=309225062
> 14/04/16 12:01:49 INFO MemoryStore: Block broadcast_0 stored as values to
> memory (estimated size 55.1 KB, free 294.8 MB)
> 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Connected to Spark
> cluster with app ID app-20140416120149-0162
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added:
> app-20140416120149-0162/0 on
> worker-20140408030727-brick12.ipads-lab.se.sjtu.edu.cn-35300 (
> brick12.ipads-lab.se.sjtu.edu.cn:35300) with 16 cores
> 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID
> app-20140416120149-0162/0 on hostPort
> brick12.ipads-lab.se.sjtu.edu.cn:35300 with 16 cores, 62.0 GB RAM
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added:
> app-20140416120149-0162/1 on
> worker-20140408031122-brick11.ipads-lab.se.sjtu.edu.cn-53010 (
> brick11.ipads-lab.se.sjtu.edu.cn:53010) with 16 cores
> 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID
> app-20140416120149-0162/1 on hostPort
> brick11.ipads-lab.se.sjtu.edu.cn:53010 with 16 cores, 62.0 GB RAM
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added:
> app-20140416120149-0162/2 on
> worker-20140408030548-brick10.ipads-lab.se.sjtu.edu.cn-54839 (
> brick10.ipads-lab.se.sjtu.edu.cn:54839) with 16 cores
> 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID
> app-20140416120149-0162/2 on hostPort
> brick10.ipads-lab.se.sjtu.edu.cn:54839 with 16 cores, 62.0 GB RAM
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added:
> app-20140416120149-0162/3 on
> worker-20140408030546-brick13.ipads-lab.se.sjtu.edu.cn-54297 (
> brick13.ipads-lab.se.sjtu.edu.cn:54297) with 16 cores
> 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID
> app-20140416120149-0162/3 on hostPort
> brick13.ipads-lab.se.sjtu.edu.cn:54297 with 16 cores, 62.0 GB RAM
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated:
> app-20140416120149-0162/0 is now RUNNING
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated:
> app-20140416120149-0162/1 is now RUNNING
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated:
> app-20140416120149-0162/3 is now RUNNING
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated:
> app-20140416120149-0162/2 is now RUNNING
> 14/04/16 12:01:49 WARN NativeCodeLoader: Unable to load native-hadoop
> library for your platform... using builtin-java classes where applicable
> 14/04/16 12:01:49 WARN LoadSnappy: Snappy native library not loaded
> 14/04/16 12:01:49 INFO FileInputFormat: Total input paths to process : 16
> 14/04/16 12:01:49 INFO SparkContext: Starting job: collect at
> Skyline.scala:79
> 14/04/16 12:01:49 INFO DAGScheduler: Got job 0 (collect at
> Skyline.scala:79) with 32 output partitions (allowLocal=false)
> 14/04/16 12:01:49 INFO DAGScheduler: Final stage: Stage 0 (collect at
> Skyline.scala:79)
> 14/04/16 12:01:49 INFO DAGScheduler: Parents of final stage: List()
> 14/04/16 12:01:49 INFO DAGScheduler: Missing parents: List()
> 14/04/16 12:01:49 INFO DAGScheduler: Submitting Stage 0
> (MapPartitionsRDD[3] at mapPartitions at Skyline.scala:79), which has no
> missing parents
> 14/04/16 12:01:49 INFO DAGScheduler: Submitting 32 missing tasks from
> Stage 0 (MapPartitionsRDD[3] at mapPartitions at Skyline.scala:79)
> 14/04/16 12:01:49 INFO TaskSchedulerImpl: Adding task set 0.0 with 32 tasks
> 14/04/16 12:01:51 INFO SparkDeploySchedulerBackend: Registered executor:
> Actor[akka.tcp://
> sparkExecutor@brick10.ipads-lab.se.sjtu.edu.cn:35324/user/Executor#-869520545]
> with ID 2
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:0 as TID 0 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:0 as 1864 bytes
> in 7 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:1 as TID 1 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:1 as 1864 bytes
> in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:2 as TID 2 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:2 as 1864 bytes
> in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:3 as TID 3 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:3 as 1864 bytes
> in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:4 as TID 4 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:4 as 1864 bytes
> in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:5 as TID 5 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:5 as 1864 bytes
> in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:6 as TID 6 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:6 as 1864 bytes
> in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:7 as TID 7 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:7 as 1864 bytes
> in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:8 as TID 8 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:8 as 1864 bytes
> in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:9 as TID 9 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:9 as 1864 bytes
> in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:10 as TID 10 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:10 as 1864
> bytes in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:11 as TID 11 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:11 as 1864
> bytes in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:12 as TID 12 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:12 as 1864
> bytes in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:13 as TID 13 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:13 as 1864
> bytes in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:14 as TID 14 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:14 as 1864
> bytes in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:15 as TID 15 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:15 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor:
> Actor[akka.tcp://
> sparkExecutor@brick11.ipads-lab.se.sjtu.edu.cn:60803/user/Executor#812944754]
> with ID 1
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:16 as TID 16 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:16 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:17 as TID 17 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:17 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:18 as TID 18 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:18 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:19 as TID 19 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:19 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:20 as TID 20 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:20 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:21 as TID 21 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:21 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:22 as TID 22 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:22 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:23 as TID 23 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:23 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:24 as TID 24 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:24 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:25 as TID 25 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:25 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:26 as TID 26 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:26 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:27 as TID 27 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:27 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:28 as TID 28 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:28 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:29 as TID 29 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:29 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:30 as TID 30 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:30 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:31 as TID 31 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:31 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor:
> Actor[akka.tcp://
> sparkExecutor@brick13.ipads-lab.se.sjtu.edu.cn:57722/user/Executor#1718525013]
> with ID 3
> 14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor:
> Actor[akka.tcp://
> sparkExecutor@brick12.ipads-lab.se.sjtu.edu.cn:51585/user/Executor#-1756663662]
> with ID 0
> 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager
> brick10.ipads-lab.se.sjtu.edu.cn:35695 with 35.7 GB RAM
> 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager
> brick11.ipads-lab.se.sjtu.edu.cn:54679 with 35.7 GB RAM
> 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager
> brick13.ipads-lab.se.sjtu.edu.cn:42178 with 35.7 GB RAM
> 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager
> brick12.ipads-lab.se.sjtu.edu.cn:50560 with 35.7 GB RAM
> 14/04/16 12:02:14 INFO TaskSetManager: Finished TID 23 in 22711 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 1/32)
> 14/04/16 12:02:14 INFO DAGScheduler: Completed ResultTask(0, 23)
> 14/04/16 12:02:15 INFO DAGScheduler: Completed ResultTask(0, 20)
> 14/04/16 12:02:15 INFO TaskSetManager: Finished TID 20 in 23529 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 2/32)
> 14/04/16 12:02:16 INFO DAGScheduler: Completed ResultTask(0, 26)
> 14/04/16 12:02:16 INFO TaskSetManager: Finished TID 26 in 24238 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 3/32)
> 14/04/16 12:02:16 INFO DAGScheduler: Completed ResultTask(0, 4)
> 14/04/16 12:02:16 INFO TaskSetManager: Finished TID 4 in 24929 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 4/32)
> 14/04/16 12:02:17 INFO DAGScheduler: Completed ResultTask(0, 2)
> 14/04/16 12:02:17 INFO TaskSetManager: Finished TID 2 in 25977 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 5/32)
> 14/04/16 12:02:18 INFO DAGScheduler: Completed ResultTask(0, 31)
> 14/04/16 12:02:18 INFO TaskSetManager: Finished TID 31 in 26453 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 6/32)
> 14/04/16 12:02:18 INFO DAGScheduler: Completed ResultTask(0, 5)
> 14/04/16 12:02:18 INFO TaskSetManager: Finished TID 5 in 26739 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 7/32)
> 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 12)
> 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 12 in 27342 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 8/32)
> 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 14)
> 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 14 in 27457 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 9/32)
> 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 8)
> 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 8 in 27604 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 10/32)
> 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 10)
> 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 10 in 27923 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 11/32)
> 14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 7)
> 14/04/16 12:02:20 INFO TaskSetManager: Finished TID 7 in 28544 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 12/32)
> 14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 27)
> 14/04/16 12:02:20 INFO TaskSetManager: Finished TID 27 in 28709 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 13/32)
> 14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 6)
> 14/04/16 12:02:20 INFO TaskSetManager: Finished TID 6 in 28965 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 14/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 0)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 0 in 29165 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 15/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 9)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 9 in 29256 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 16/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 13)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 13 in 29311 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 17/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 15)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 15 in 29378 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 18/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 11)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 11 in 29539 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 19/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 3)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 3 in 29608 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 20/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 1)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 1 in 29615 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 21/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 22)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 22 in 29880 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 22/32)
> 14/04/16 12:02:22 INFO DAGScheduler: Completed ResultTask(0, 19)
> 14/04/16 12:02:22 INFO TaskSetManager: Finished TID 19 in 30727 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 23/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 18)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 18 in 31005 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 24/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 25)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 25 in 31013 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 25/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 28)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 28 in 31216 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 26/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 21)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 21 in 31259 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 27/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 30)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 30 in 31301 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 28/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 16)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 16 in 31439 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 29/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 29)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 29 in 31611 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 30/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 24)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 24 in 31824 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 31/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 17)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 17 in 31907 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 32/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Stage 0 (collect at Skyline.scala:79)
> finished in 33.984 s
> 14/04/16 12:02:23 INFO TaskSchedulerImpl: Removed TaskSet 0.0, whose tasks
> have all completed, from pool
> 14/04/16 12:02:23 INFO SparkContext: Job finished: collect at
> Skyline.scala:79, took 34.154637267 s
>
>
> Sorry if some of these questions are really trivial. Thanks for any
> explanations again.
>
> Yanzhe
>
> On Wednesday, April 16, 2014 at 1:37 AM, Cheng Lian wrote:
>
> Your Spark solution first reduces partial results into a single partition,
> computes the final result, and then collects to the driver side. This
> involves a shuffle and two waves of network traffic. Instead, you can
> directly collect partial results to the driver and then computes the final
> results on driver side:
>
> val data = sc.textFile(...).map(line => line.split(",").map(_.toDouble))val partialResults = data.mapPartitions(points => skyline(points.toArray).iterator).collect()val results = skyline(partialResults)
>
> On Wed, Apr 16, 2014 at 1:03 AM, Yanzhe Chen <ya...@gmail.com> wrote:
>
> Hi all,
>
> As a previous thread, I am asking how to implement a divide-and-conquer
> algorithm (skyline) in Spark.
> Here is my current solution:
>
> val data = sc.textFile(…).map(line => line.split(“,”).map(_.toDouble))
>
> val result = data.mapPartitions(points => *skyline*(points.toArray).iterator).coalesce(1,
> true)
> .mapPartitions(points => *skyline*
> (points.toArray).iterator).collect()
>
> where skyline is a local algorithm to compute the results:
>
> def *skyline*(points: Array[Point]) : Array[Point]
>
> Basically, I find this implement runs slower than the corresponding Hadoop
> version (the identity map phase plus local skyline for both combine and
> reduce phases).
>
> Below are my questions:
>
> 1. Why this implementation is much slower than the Hadoop one?
>
> I can find two possible reasons: one is the shuffle overhead in coalesce,
> another is calling the toArray and iterator repeatedly when invoking
> local skyline algorithm. But I am not sure which one is true.
>
> I haven’t seen your Hadoop version. But if this assumption is right, the
> above version should help.
>
>
> 2. One observation is that while Hadoop version almost used up all the CPU
> resources during execution, the CPU seems not that hot on Spark. Is that a
> clue to prove that the shuffling might be the real bottleneck?
>
> How many parallel tasks are there when running your Spark code? I doubt
> tasks are queued and run sequentially.
>
>
> 3. Is there any difference between coalesce(1, true) and reparation? It
> seems that both opeartions need shuffling data. What’s the proper
> situations using the coalesce method?
>
> repartition(n) is just an alias of coalesce(n, true), so yes, they both
> involve data shuffling. coalesce can be used to shrink partition number
> when dataset size shrinks dramatically after operations like filter. Say
> you have an RDD containing 1TB of data with 100 partitions, after a
> .filter(...) call, only 20GB data left, then you may want to coalesce to
> 2 partitions rather than 100.
>
>
> 4. More generally, I am trying to implementing some core geometry
> computation operators on Spark (like skyline, convex hull etc). In my
> understanding, since Spark is more capable of handling iterative
> computations on dataset, the above solution apparently doesn’t exploit what
> Spark is good at. Any comments on how to do geometry computations on Spark
> (if it is possible) ?
>
> Although Spark is good at iterative algorithms, it also performs better in
> batch computing due to much lower scheduling overhead and thread level
> parallelism. Theoretically, you can always accelerate your MapReduce job by
> rewriting it in Spark.
>
>
> Thanks for any insight.
>
> Yanzhe
>
>
>
>
Re: Why these operations are slower than the equivalent on
Hadoop?
Posted by Yanzhe Chen <ya...@gmail.com>.
Hi Cheng,
Thanks for your help! I have pasted my Spark and Hadoop skyline code on Github:
Spark version: https://gist.github.com/yanzhe-chen/10828117
Hadoop version: https://gist.github.com/yanzhe-chen/10828988
Best,
Yanzhe
On Wednesday, April 16, 2014 at 3:43 PM, Cheng Lian wrote:
>
> On Wed, Apr 16, 2014 at 12:08 PM, Yanzhe Chen <yanzhe.cn@gmail.com (mailto:yanzhe.cn@gmail.com)> wrote:
>
>
> …
>
>
>
>
>
> >
> >
> >
> > > Clusters will not be fully utilized unless you set the level of parallelism for each operation high enough. Spark automatically sets the number of “map” tasks to run on each file according to its size (though you can control it through optional parameters to SparkContext.textFile, etc),
> >
> > Does this mean if I call SparkContext.textFile(path, minSplit), then each file will be split into *minSplit* partitions? And if it is, say my input has 16 files, and minSplit is set to 2, does that mean Spark will generate 32 tasks if I call mapPartitions?
> >
>
>
>
>
>
>
>
> Things are a bit more complicated. minSplit is just a hint of partition numbers, it just specifies a minimum partition number. The actual partition number is decided by the underlying Hadoop InputFormat, and may be larger than minSplit (e.g. when size of individual input file is larger than an HDFS block). If you want to set partition number to n precisely, you may try this:
>
> sc.textFile(path, n).coalesce(n)
>
>
>
>
> > > and for distributed “reduce” operations, such as groupByKey and reduceByKey, it uses the largest parent RDD’s number of partitions. You can pass the level of parallelism as a second argument (see the spark.PairRDDFunctions (https://spark.apache.org/docs/0.9.0/api/core/index.html#org.apache.spark.rdd.PairRDDFunctions) documentation),
> >
> > It seems that currently I don’t use any group operations so does this mean there are no distributed “reduce” operations in my code? Does collect operation belongs to “reduce” operation?
> >
>
>
>
>
>
>
>
> The essence of “distributed reduce” operation is that those operations involve data shuffling. So collect isn’t a “distributed reduce” operation, it’s an action (which triggers a job). It just collects data from executors to the driver. And yes, your code doesn’t have any distributed “reduce” operation.
>
>
>
>
>
> > > or set the config property spark.default.parallelism to change the default. In general, we recommend 2-3 tasks per CPU core in your cluster.
> >
> > If minSplit in SparkContext.textFile specify the parallelism on map side and PairRDDFunctions’s second argument controls the parallelism of reduce side. What spark.default.parallelism used for?
> >
>
>
>
>
> spark.default.parallelism is used to decide RDD partition number when you don’t specify any.
>
>
>
>
>
> >
> > Besides, I pasted the LOG of my driver program here and can you tell the whether the tasks are queued and run sequentially?
>
>
>
>
>
>
> From the log, I can see 32 tasks run in parallel. I can’t give any further suggestions without more details now. Would you please paste simplified but complete version of your Spark and Hadoop skyline code to GitHub gist?
>
>
>
>
>
> >
> > I have a four-node cluster (brick10 - brick13) and each with 16-core and 64GB. And the parameters in the Tuning Guide are all set to default ( spark.default.parallelism = 8 and minSplit = 2). The input data is 1GB random generated points.
> >
> > 14/04/16 12:01:46 INFO SecurityManager: SecurityManager, is authentication enabled: false are ui acls enabled: false users with view permissions: Set(yanzhe)
> > 14/04/16 12:01:47 INFO Slf4jLogger: Slf4jLogger started
> > 14/04/16 12:01:47 INFO Remoting: Starting remoting
> > 14/04/16 12:01:47 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://spark@brick5.ipads-lab.se.sjtu.edu.cn:49364 (http://spark@brick5.ipads-lab.se.sjtu.edu.cn:49364)]
> > 14/04/16 12:01:47 INFO Remoting: Remoting now listens on addresses: [akka.tcp://spark@brick5.ipads-lab.se.sjtu.edu.cn:49364 (http://spark@brick5.ipads-lab.se.sjtu.edu.cn:49364)]
> > 14/04/16 12:01:47 INFO SparkEnv: Registering BlockManagerMaster
> > 14/04/16 12:01:47 INFO DiskBlockManager: Created local directory at /tmp/spark-local-20140416120147-d6a9
> > 14/04/16 12:01:47 INFO MemoryStore: MemoryStore started with capacity 294.9 MB.
> > 14/04/16 12:01:48 INFO ConnectionManager: Bound socket to port 44635 with id = ConnectionManagerId(brick5.ipads-lab.se.sjtu.edu.cn (http://brick5.ipads-lab.se.sjtu.edu.cn),44635)
> > 14/04/16 12:01:48 INFO BlockManagerMaster: Trying to register BlockManager
> > 14/04/16 12:01:48 INFO BlockManagerInfo: Registering block manager brick5.ipads-lab.se.sjtu.edu.cn:44635 (http://brick5.ipads-lab.se.sjtu.edu.cn:44635) with 294.9 MB RAM
> > 14/04/16 12:01:48 INFO BlockManagerMaster: Registered BlockManager
> > 14/04/16 12:01:48 INFO HttpServer: Starting HTTP Server
> > 14/04/16 12:01:48 INFO HttpBroadcast: Broadcast server started at http://192.168.12.184:54396
> > 14/04/16 12:01:48 INFO SparkEnv: Registering MapOutputTracker
> > 14/04/16 12:01:48 INFO HttpFileServer: HTTP File server directory is /tmp/spark-75415972-fc25-4f12-a337-79abce06c085
> > 14/04/16 12:01:48 INFO HttpServer: Starting HTTP Server
> > 14/04/16 12:01:48 INFO SparkUI: Started Spark Web UI at http://brick5.ipads-lab.se.sjtu.edu.cn:4040
> > 14/04/16 12:01:49 INFO SparkContext: Added JAR /home/yanzhe/gislib_2.10-0.1.jar at http://192.168.12.184:54005/jars/gislib_2.10-0.1.jar with timestamp 1397620909025
> > 14/04/16 12:01:49 INFO AppClient$ClientActor: Connecting to master spark://brick5:7077...
> > 14/04/16 12:01:49 INFO MemoryStore: ensureFreeSpace(56397) called with curMem=0, maxMem=309225062
> > 14/04/16 12:01:49 INFO MemoryStore: Block broadcast_0 stored as values to memory (estimated size 55.1 KB, free 294.8 MB)
> > 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Connected to Spark cluster with app ID app-20140416120149-0162
> > 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added: app-20140416120149-0162/0 on worker-20140408030727-brick12.ipads-lab.se.sjtu.edu.cn-35300 (brick12.ipads-lab.se.sjtu.edu.cn:35300 (http://brick12.ipads-lab.se.sjtu.edu.cn:35300)) with 16 cores
> > 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID app-20140416120149-0162/0 on hostPort brick12.ipads-lab.se.sjtu.edu.cn:35300 (http://brick12.ipads-lab.se.sjtu.edu.cn:35300) with 16 cores, 62.0 GB RAM
> > 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added: app-20140416120149-0162/1 on worker-20140408031122-brick11.ipads-lab.se.sjtu.edu.cn-53010 (brick11.ipads-lab.se.sjtu.edu.cn:53010 (http://brick11.ipads-lab.se.sjtu.edu.cn:53010)) with 16 cores
> > 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID app-20140416120149-0162/1 on hostPort brick11.ipads-lab.se.sjtu.edu.cn:53010 (http://brick11.ipads-lab.se.sjtu.edu.cn:53010) with 16 cores, 62.0 GB RAM
> > 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added: app-20140416120149-0162/2 on worker-20140408030548-brick10.ipads-lab.se.sjtu.edu.cn-54839 (brick10.ipads-lab.se.sjtu.edu.cn:54839 (http://brick10.ipads-lab.se.sjtu.edu.cn:54839)) with 16 cores
> > 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID app-20140416120149-0162/2 on hostPort brick10.ipads-lab.se.sjtu.edu.cn:54839 (http://brick10.ipads-lab.se.sjtu.edu.cn:54839) with 16 cores, 62.0 GB RAM
> > 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added: app-20140416120149-0162/3 on worker-20140408030546-brick13.ipads-lab.se.sjtu.edu.cn-54297 (brick13.ipads-lab.se.sjtu.edu.cn:54297 (http://brick13.ipads-lab.se.sjtu.edu.cn:54297)) with 16 cores
> > 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID app-20140416120149-0162/3 on hostPort brick13.ipads-lab.se.sjtu.edu.cn:54297 (http://brick13.ipads-lab.se.sjtu.edu.cn:54297) with 16 cores, 62.0 GB RAM
> > 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated: app-20140416120149-0162/0 is now RUNNING
> > 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated: app-20140416120149-0162/1 is now RUNNING
> > 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated: app-20140416120149-0162/3 is now RUNNING
> > 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated: app-20140416120149-0162/2 is now RUNNING
> > 14/04/16 12:01:49 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
> > 14/04/16 12:01:49 WARN LoadSnappy: Snappy native library not loaded
> > 14/04/16 12:01:49 INFO FileInputFormat: Total input paths to process : 16
> > 14/04/16 12:01:49 INFO SparkContext: Starting job: collect at Skyline.scala:79
> > 14/04/16 12:01:49 INFO DAGScheduler: Got job 0 (collect at Skyline.scala:79) with 32 output partitions (allowLocal=false)
> > 14/04/16 12:01:49 INFO DAGScheduler: Final stage: Stage 0 (collect at Skyline.scala:79)
> > 14/04/16 12:01:49 INFO DAGScheduler: Parents of final stage: List()
> > 14/04/16 12:01:49 INFO DAGScheduler: Missing parents: List()
> > 14/04/16 12:01:49 INFO DAGScheduler: Submitting Stage 0 (MapPartitionsRDD[3] at mapPartitions at Skyline.scala:79), which has no missing parents
> > 14/04/16 12:01:49 INFO DAGScheduler: Submitting 32 missing tasks from Stage 0 (MapPartitionsRDD[3] at mapPartitions at Skyline.scala:79)
> > 14/04/16 12:01:49 INFO TaskSchedulerImpl: Adding task set 0.0 with 32 tasks
> > 14/04/16 12:01:51 INFO SparkDeploySchedulerBackend: Registered executor: Actor[akka.tcp://sparkExecutor@brick10.ipads-lab.se.sjtu.edu.cn:35324/user/Executor#-869520545 (http://sparkExecutor@brick10.ipads-lab.se.sjtu.edu.cn:35324/user/Executor#-869520545)] with ID 2
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:0 as TID 0 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:0 as 1864 bytes in 7 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:1 as TID 1 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:1 as 1864 bytes in 0 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:2 as TID 2 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:2 as 1864 bytes in 0 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:3 as TID 3 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:3 as 1864 bytes in 0 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:4 as TID 4 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:4 as 1864 bytes in 0 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:5 as TID 5 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:5 as 1864 bytes in 0 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:6 as TID 6 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:6 as 1864 bytes in 1 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:7 as TID 7 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:7 as 1864 bytes in 1 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:8 as TID 8 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:8 as 1864 bytes in 1 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:9 as TID 9 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:9 as 1864 bytes in 1 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:10 as TID 10 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:10 as 1864 bytes in 1 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:11 as TID 11 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:11 as 1864 bytes in 1 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:12 as TID 12 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:12 as 1864 bytes in 0 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:13 as TID 13 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:13 as 1864 bytes in 1 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:14 as TID 14 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:14 as 1864 bytes in 0 ms
> > 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:15 as TID 15 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:15 as 1864 bytes in 0 ms
> > 14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor: Actor[akka.tcp://sparkExecutor@brick11.ipads-lab.se.sjtu.edu.cn:60803/user/Executor#812944754 (http://sparkExecutor@brick11.ipads-lab.se.sjtu.edu.cn:60803/user/Executor#812944754)] with ID 1
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:16 as TID 16 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:16 as 1864 bytes in 1 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:17 as TID 17 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:17 as 1864 bytes in 1 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:18 as TID 18 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:18 as 1864 bytes in 1 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:19 as TID 19 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:19 as 1864 bytes in 0 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:20 as TID 20 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:20 as 1864 bytes in 1 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:21 as TID 21 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:21 as 1864 bytes in 0 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:22 as TID 22 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:22 as 1864 bytes in 1 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:23 as TID 23 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:23 as 1864 bytes in 1 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:24 as TID 24 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:24 as 1864 bytes in 1 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:25 as TID 25 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:25 as 1864 bytes in 0 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:26 as TID 26 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:26 as 1864 bytes in 1 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:27 as TID 27 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:27 as 1864 bytes in 1 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:28 as TID 28 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:28 as 1864 bytes in 1 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:29 as TID 29 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:29 as 1864 bytes in 1 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:30 as TID 30 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:30 as 1864 bytes in 0 ms
> > 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:31 as TID 31 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (PROCESS_LOCAL)
> > 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:31 as 1864 bytes in 0 ms
> > 14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor: Actor[akka.tcp://sparkExecutor@brick13.ipads-lab.se.sjtu.edu.cn:57722/user/Executor#1718525013 (http://sparkExecutor@brick13.ipads-lab.se.sjtu.edu.cn:57722/user/Executor#1718525013)] with ID 3
> > 14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor: Actor[akka.tcp://sparkExecutor@brick12.ipads-lab.se.sjtu.edu.cn:51585/user/Executor#-1756663662 (http://sparkExecutor@brick12.ipads-lab.se.sjtu.edu.cn:51585/user/Executor#-1756663662)] with ID 0
> > 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager brick10.ipads-lab.se.sjtu.edu.cn:35695 (http://brick10.ipads-lab.se.sjtu.edu.cn:35695) with 35.7 GB RAM
> > 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager brick11.ipads-lab.se.sjtu.edu.cn:54679 (http://brick11.ipads-lab.se.sjtu.edu.cn:54679) with 35.7 GB RAM
> > 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager brick13.ipads-lab.se.sjtu.edu.cn:42178 (http://brick13.ipads-lab.se.sjtu.edu.cn:42178) with 35.7 GB RAM
> > 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager brick12.ipads-lab.se.sjtu.edu.cn:50560 (http://brick12.ipads-lab.se.sjtu.edu.cn:50560) with 35.7 GB RAM
> > 14/04/16 12:02:14 INFO TaskSetManager: Finished TID 23 in 22711 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 1/32)
> > 14/04/16 12:02:14 INFO DAGScheduler: Completed ResultTask(0, 23)
> > 14/04/16 12:02:15 INFO DAGScheduler: Completed ResultTask(0, 20)
> > 14/04/16 12:02:15 INFO TaskSetManager: Finished TID 20 in 23529 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 2/32)
> > 14/04/16 12:02:16 INFO DAGScheduler: Completed ResultTask(0, 26)
> > 14/04/16 12:02:16 INFO TaskSetManager: Finished TID 26 in 24238 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 3/32)
> > 14/04/16 12:02:16 INFO DAGScheduler: Completed ResultTask(0, 4)
> > 14/04/16 12:02:16 INFO TaskSetManager: Finished TID 4 in 24929 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 4/32)
> > 14/04/16 12:02:17 INFO DAGScheduler: Completed ResultTask(0, 2)
> > 14/04/16 12:02:17 INFO TaskSetManager: Finished TID 2 in 25977 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 5/32)
> > 14/04/16 12:02:18 INFO DAGScheduler: Completed ResultTask(0, 31)
> > 14/04/16 12:02:18 INFO TaskSetManager: Finished TID 31 in 26453 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 6/32)
> > 14/04/16 12:02:18 INFO DAGScheduler: Completed ResultTask(0, 5)
> > 14/04/16 12:02:18 INFO TaskSetManager: Finished TID 5 in 26739 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 7/32)
> > 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 12)
> > 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 12 in 27342 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 8/32)
> > 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 14)
> > 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 14 in 27457 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 9/32)
> > 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 8)
> > 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 8 in 27604 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 10/32)
> > 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 10)
> > 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 10 in 27923 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 11/32)
> > 14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 7)
> > 14/04/16 12:02:20 INFO TaskSetManager: Finished TID 7 in 28544 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 12/32)
> > 14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 27)
> > 14/04/16 12:02:20 INFO TaskSetManager: Finished TID 27 in 28709 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 13/32)
> > 14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 6)
> > 14/04/16 12:02:20 INFO TaskSetManager: Finished TID 6 in 28965 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 14/32)
> > 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 0)
> > 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 0 in 29165 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 15/32)
> > 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 9)
> > 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 9 in 29256 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 16/32)
> > 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 13)
> > 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 13 in 29311 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 17/32)
> > 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 15)
> > 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 15 in 29378 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 18/32)
> > 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 11)
> > 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 11 in 29539 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 19/32)
> > 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 3)
> > 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 3 in 29608 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 20/32)
> > 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 1)
> > 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 1 in 29615 ms on brick10.ipads-lab.se.sjtu.edu.cn (http://brick10.ipads-lab.se.sjtu.edu.cn) (progress: 21/32)
> > 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 22)
> > 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 22 in 29880 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 22/32)
> > 14/04/16 12:02:22 INFO DAGScheduler: Completed ResultTask(0, 19)
> > 14/04/16 12:02:22 INFO TaskSetManager: Finished TID 19 in 30727 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 23/32)
> > 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 18)
> > 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 18 in 31005 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 24/32)
> > 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 25)
> > 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 25 in 31013 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 25/32)
> > 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 28)
> > 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 28 in 31216 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 26/32)
> > 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 21)
> > 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 21 in 31259 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 27/32)
> > 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 30)
> > 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 30 in 31301 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 28/32)
> > 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 16)
> > 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 16 in 31439 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 29/32)
> > 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 29)
> > 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 29 in 31611 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 30/32)
> > 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 24)
> > 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 24 in 31824 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 31/32)
> > 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 17)
> > 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 17 in 31907 ms on brick11.ipads-lab.se.sjtu.edu.cn (http://brick11.ipads-lab.se.sjtu.edu.cn) (progress: 32/32)
> > 14/04/16 12:02:23 INFO DAGScheduler: Stage 0 (collect at Skyline.scala:79) finished in 33.984 s
> > 14/04/16 12:02:23 INFO TaskSchedulerImpl: Removed TaskSet 0.0, whose tasks have all completed, from pool
> > 14/04/16 12:02:23 INFO SparkContext: Job finished: collect at Skyline.scala:79, took 34.154637267 s
> >
> >
> >
> >
> >
> > Sorry if some of these questions are really trivial. Thanks for any explanations again.
> >
> > Yanzhe
> >
> >
> >
> > On Wednesday, April 16, 2014 at 1:37 AM, Cheng Lian wrote:
> >
> > >
> > > Your Spark solution first reduces partial results into a single partition, computes the final result, and then collects to the driver side. This involves a shuffle and two waves of network traffic. Instead, you can directly collect partial results to the driver and then computes the final results on driver side:
> > >
> > > val data = sc.textFile(...).map(line => line.split(",").map(_.toDouble)) val partialResults = data.mapPartitions(points => skyline(points.toArray).iterator).collect() val results = skyline(partialResults)
> > >
> > > On Wed, Apr 16, 2014 at 1:03 AM, Yanzhe Chen <yanzhe.cn@gmail.com (mailto:yanzhe.cn@gmail.com)> wrote:
> > >
> > >
> > >
> > >
> > >
> > > > Hi all,
> > > >
> > > > As a previous thread, I am asking how to implement a divide-and-conquer algorithm (skyline) in Spark.
> > > > Here is my current solution:
> > > >
> > > > val data = sc.textFile(…).map(line => line.split(“,”).map(_.toDouble))
> > > >
> > > > val result = data.mapPartitions(points => skyline(points.toArray).iterator).coalesce(1, true)
> > > > .mapPartitions(points => skyline(points.toArray).iterator).collect()
> > > >
> > > > where skyline is a local algorithm to compute the results:
> > > >
> > > > def skyline(points: Array[Point]) : Array[Point]
> > > >
> > > > Basically, I find this implement runs slower than the corresponding Hadoop version (the identity map phase plus local skyline for both combine and reduce phases).
> > > >
> > > > Below are my questions:
> > > >
> > > > 1. Why this implementation is much slower than the Hadoop one?
> > > >
> > > > I can find two possible reasons: one is the shuffle overhead in coalesce, another is calling the toArray and iterator repeatedly when invoking local skyline algorithm. But I am not sure which one is true.
> > >
> > >
> > >
> > >
> > >
> > >
> > > I haven’t seen your Hadoop version. But if this assumption is right, the above version should help.
> > >
> > >
> > >
> > >
> > >
> > > >
> > > > 2. One observation is that while Hadoop version almost used up all the CPU resources during execution, the CPU seems not that hot on Spark. Is that a clue to prove that the shuffling might be the real bottleneck?
> > >
> > >
> > >
> > >
> > >
> > >
> > > How many parallel tasks are there when running your Spark code? I doubt tasks are queued and run sequentially.
> > >
> > >
> > >
> > >
> > >
> > > >
> > > > 3. Is there any difference between coalesce(1, true) and reparation? It seems that both opeartions need shuffling data. What’s the proper situations using the coalesce method?
> > >
> > >
> > >
> > >
> > >
> > >
> > > repartition(n) is just an alias of coalesce(n, true), so yes, they both involve data shuffling. coalesce can be used to shrink partition number when dataset size shrinks dramatically after operations like filter. Say you have an RDD containing 1TB of data with 100 partitions, after a .filter(...) call, only 20GB data left, then you may want to coalesce to 2 partitions rather than 100.
> > >
> > >
> > >
> > >
> > >
> > > >
> > > > 4. More generally, I am trying to implementing some core geometry computation operators on Spark (like skyline, convex hull etc). In my understanding, since Spark is more capable of handling iterative computations on dataset, the above solution apparently doesn’t exploit what Spark is good at. Any comments on how to do geometry computations on Spark (if it is possible) ?
> > >
> > >
> > >
> > >
> > >
> > >
> > > Although Spark is good at iterative algorithms, it also performs better in batch computing due to much lower scheduling overhead and thread level parallelism. Theoretically, you can always accelerate your MapReduce job by rewriting it in Spark.
> > >
> > >
> > >
> > >
> > >
> > > >
> > > > Thanks for any insight.
> > > >
> > > > Yanzhe
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
>
>
>
>
>
Re: Why these operations are slower than the equivalent on Hadoop?
Posted by Cheng Lian <li...@gmail.com>.
On Wed, Apr 16, 2014 at 12:08 PM, Yanzhe Chen <ya...@gmail.com> wrote:
…
Clusters will not be fully utilized unless you set the level of parallelism
> for each operation high enough. Spark automatically sets the number of
> “map” tasks to run on each file according to its size (though you can
> control it through optional parameters to SparkContext.textFile, etc),
>
> Does this mean if I call SparkContext.textFile(path, minSplit), then each
> file will be split into *minSplit* partitions? And if it is, say my input
> has 16 files, and minSplit is set to 2, does that mean Spark will generate
> 32 tasks if I call mapPartitions?
>
Things are a bit more complicated. minSplit is just a hint of partition
numbers, it just specifies a minimum partition number. The actual partition
number is decided by the underlying Hadoop InputFormat, and may be larger
than minSplit (e.g. when size of individual input file is larger than an
HDFS block). If you want to set partition number to n precisely, you may
try this:
sc.textFile(path, n).coalesce(n)
and for distributed “reduce” operations, such as groupByKey and reduceByKey,
> it uses the largest parent RDD’s number of partitions. You can pass the
> level of parallelism as a second argument (see the spark.PairRDDFunctions<https://spark.apache.org/docs/0.9.0/api/core/index.html#org.apache.spark.rdd.PairRDDFunctions> documentation),
>
>
> It seems that currently I don’t use any group operations so does this mean
> there are no distributed “reduce” operations in my code? Does collect
> operation belongs to “reduce” operation?
>
The essence of “distributed reduce” operation is that those operations
involve data shuffling. So collect isn’t a “distributed reduce” operation,
it’s an action (which triggers a job). It just collects data from executors
to the driver. And yes, your code doesn’t have any distributed “reduce”
operation.
or set the config property spark.default.parallelism to change the default.
> In general, we recommend 2-3 tasks per CPU core in your cluster.
>
> If minSplit in SparkContext.textFile specify the parallelism on map side
> and PairRDDFunctions’s second argument controls the parallelism of reduce
> side. What spark.default.parallelism used for?
>
> spark.default.parallelism is used to decide RDD partition number when you
don’t specify any.
> Besides, I pasted the LOG of my driver program here and can you tell the
> whether the tasks are queued and run sequentially?
>
>From the log, I can see 32 tasks run in parallel. I can’t give any further
suggestions without more details now. Would you please paste simplified but
complete version of your Spark and Hadoop skyline code to GitHub gist?
> I have a four-node cluster (brick10 - brick13) and each with 16-core and
> 64GB. And the parameters in the Tuning Guide are all set to default (
> spark.default.parallelism = 8 and minSplit = 2). The input data is 1GB
> random generated points.
>
> 14/04/16 12:01:46 INFO SecurityManager: SecurityManager, is authentication
> enabled: false are ui acls enabled: false users with view permissions:
> Set(yanzhe)
> 14/04/16 12:01:47 INFO Slf4jLogger: Slf4jLogger started
> 14/04/16 12:01:47 INFO Remoting: Starting remoting
> 14/04/16 12:01:47 INFO Remoting: Remoting started; listening on addresses
> :[akka.tcp://spark@brick5.ipads-lab.se.sjtu.edu.cn:49364]
> 14/04/16 12:01:47 INFO Remoting: Remoting now listens on addresses:
> [akka.tcp://spark@brick5.ipads-lab.se.sjtu.edu.cn:49364]
> 14/04/16 12:01:47 INFO SparkEnv: Registering BlockManagerMaster
> 14/04/16 12:01:47 INFO DiskBlockManager: Created local directory at
> /tmp/spark-local-20140416120147-d6a9
> 14/04/16 12:01:47 INFO MemoryStore: MemoryStore started with capacity
> 294.9 MB.
> 14/04/16 12:01:48 INFO ConnectionManager: Bound socket to port 44635 with
> id = ConnectionManagerId(brick5.ipads-lab.se.sjtu.edu.cn,44635)
> 14/04/16 12:01:48 INFO BlockManagerMaster: Trying to register BlockManager
> 14/04/16 12:01:48 INFO BlockManagerInfo: Registering block manager
> brick5.ipads-lab.se.sjtu.edu.cn:44635 with 294.9 MB RAM
> 14/04/16 12:01:48 INFO BlockManagerMaster: Registered BlockManager
> 14/04/16 12:01:48 INFO HttpServer: Starting HTTP Server
> 14/04/16 12:01:48 INFO HttpBroadcast: Broadcast server started at
> http://192.168.12.184:54396
> 14/04/16 12:01:48 INFO SparkEnv: Registering MapOutputTracker
> 14/04/16 12:01:48 INFO HttpFileServer: HTTP File server directory is
> /tmp/spark-75415972-fc25-4f12-a337-79abce06c085
> 14/04/16 12:01:48 INFO HttpServer: Starting HTTP Server
> 14/04/16 12:01:48 INFO SparkUI: Started Spark Web UI at
> http://brick5.ipads-lab.se.sjtu.edu.cn:4040
> 14/04/16 12:01:49 INFO SparkContext: Added JAR
> /home/yanzhe/gislib_2.10-0.1.jar at
> http://192.168.12.184:54005/jars/gislib_2.10-0.1.jar with timestamp
> 1397620909025
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Connecting to master
> spark://brick5:7077...
> 14/04/16 12:01:49 INFO MemoryStore: ensureFreeSpace(56397) called with
> curMem=0, maxMem=309225062
> 14/04/16 12:01:49 INFO MemoryStore: Block broadcast_0 stored as values to
> memory (estimated size 55.1 KB, free 294.8 MB)
> 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Connected to Spark
> cluster with app ID app-20140416120149-0162
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added:
> app-20140416120149-0162/0 on
> worker-20140408030727-brick12.ipads-lab.se.sjtu.edu.cn-35300 (
> brick12.ipads-lab.se.sjtu.edu.cn:35300) with 16 cores
> 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID
> app-20140416120149-0162/0 on hostPort
> brick12.ipads-lab.se.sjtu.edu.cn:35300 with 16 cores, 62.0 GB RAM
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added:
> app-20140416120149-0162/1 on
> worker-20140408031122-brick11.ipads-lab.se.sjtu.edu.cn-53010 (
> brick11.ipads-lab.se.sjtu.edu.cn:53010) with 16 cores
> 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID
> app-20140416120149-0162/1 on hostPort
> brick11.ipads-lab.se.sjtu.edu.cn:53010 with 16 cores, 62.0 GB RAM
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added:
> app-20140416120149-0162/2 on
> worker-20140408030548-brick10.ipads-lab.se.sjtu.edu.cn-54839 (
> brick10.ipads-lab.se.sjtu.edu.cn:54839) with 16 cores
> 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID
> app-20140416120149-0162/2 on hostPort
> brick10.ipads-lab.se.sjtu.edu.cn:54839 with 16 cores, 62.0 GB RAM
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added:
> app-20140416120149-0162/3 on
> worker-20140408030546-brick13.ipads-lab.se.sjtu.edu.cn-54297 (
> brick13.ipads-lab.se.sjtu.edu.cn:54297) with 16 cores
> 14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID
> app-20140416120149-0162/3 on hostPort
> brick13.ipads-lab.se.sjtu.edu.cn:54297 with 16 cores, 62.0 GB RAM
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated:
> app-20140416120149-0162/0 is now RUNNING
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated:
> app-20140416120149-0162/1 is now RUNNING
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated:
> app-20140416120149-0162/3 is now RUNNING
> 14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated:
> app-20140416120149-0162/2 is now RUNNING
> 14/04/16 12:01:49 WARN NativeCodeLoader: Unable to load native-hadoop
> library for your platform... using builtin-java classes where applicable
> 14/04/16 12:01:49 WARN LoadSnappy: Snappy native library not loaded
> 14/04/16 12:01:49 INFO FileInputFormat: Total input paths to process : 16
> 14/04/16 12:01:49 INFO SparkContext: Starting job: collect at
> Skyline.scala:79
> 14/04/16 12:01:49 INFO DAGScheduler: Got job 0 (collect at
> Skyline.scala:79) with 32 output partitions (allowLocal=false)
> 14/04/16 12:01:49 INFO DAGScheduler: Final stage: Stage 0 (collect at
> Skyline.scala:79)
> 14/04/16 12:01:49 INFO DAGScheduler: Parents of final stage: List()
> 14/04/16 12:01:49 INFO DAGScheduler: Missing parents: List()
> 14/04/16 12:01:49 INFO DAGScheduler: Submitting Stage 0
> (MapPartitionsRDD[3] at mapPartitions at Skyline.scala:79), which has no
> missing parents
> 14/04/16 12:01:49 INFO DAGScheduler: Submitting 32 missing tasks from
> Stage 0 (MapPartitionsRDD[3] at mapPartitions at Skyline.scala:79)
> 14/04/16 12:01:49 INFO TaskSchedulerImpl: Adding task set 0.0 with 32 tasks
> 14/04/16 12:01:51 INFO SparkDeploySchedulerBackend: Registered executor:
> Actor[akka.tcp://
> sparkExecutor@brick10.ipads-lab.se.sjtu.edu.cn:35324/user/Executor#-869520545]
> with ID 2
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:0 as TID 0 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:0 as 1864 bytes
> in 7 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:1 as TID 1 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:1 as 1864 bytes
> in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:2 as TID 2 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:2 as 1864 bytes
> in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:3 as TID 3 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:3 as 1864 bytes
> in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:4 as TID 4 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:4 as 1864 bytes
> in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:5 as TID 5 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:5 as 1864 bytes
> in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:6 as TID 6 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:6 as 1864 bytes
> in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:7 as TID 7 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:7 as 1864 bytes
> in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:8 as TID 8 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:8 as 1864 bytes
> in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:9 as TID 9 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:9 as 1864 bytes
> in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:10 as TID 10 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:10 as 1864
> bytes in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:11 as TID 11 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:11 as 1864
> bytes in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:12 as TID 12 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:12 as 1864
> bytes in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:13 as TID 13 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:13 as 1864
> bytes in 1 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:14 as TID 14 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:14 as 1864
> bytes in 0 ms
> 14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:15 as TID 15 on
> executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:15 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor:
> Actor[akka.tcp://
> sparkExecutor@brick11.ipads-lab.se.sjtu.edu.cn:60803/user/Executor#812944754]
> with ID 1
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:16 as TID 16 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:16 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:17 as TID 17 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:17 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:18 as TID 18 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:18 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:19 as TID 19 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:19 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:20 as TID 20 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:20 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:21 as TID 21 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:21 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:22 as TID 22 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:22 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:23 as TID 23 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:23 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:24 as TID 24 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:24 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:25 as TID 25 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:25 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:26 as TID 26 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:26 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:27 as TID 27 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:27 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:28 as TID 28 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:28 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:29 as TID 29 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:29 as 1864
> bytes in 1 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:30 as TID 30 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:30 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:31 as TID 31 on
> executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
> 14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:31 as 1864
> bytes in 0 ms
> 14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor:
> Actor[akka.tcp://
> sparkExecutor@brick13.ipads-lab.se.sjtu.edu.cn:57722/user/Executor#1718525013]
> with ID 3
> 14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor:
> Actor[akka.tcp://
> sparkExecutor@brick12.ipads-lab.se.sjtu.edu.cn:51585/user/Executor#-1756663662]
> with ID 0
> 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager
> brick10.ipads-lab.se.sjtu.edu.cn:35695 with 35.7 GB RAM
> 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager
> brick11.ipads-lab.se.sjtu.edu.cn:54679 with 35.7 GB RAM
> 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager
> brick13.ipads-lab.se.sjtu.edu.cn:42178 with 35.7 GB RAM
> 14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager
> brick12.ipads-lab.se.sjtu.edu.cn:50560 with 35.7 GB RAM
> 14/04/16 12:02:14 INFO TaskSetManager: Finished TID 23 in 22711 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 1/32)
> 14/04/16 12:02:14 INFO DAGScheduler: Completed ResultTask(0, 23)
> 14/04/16 12:02:15 INFO DAGScheduler: Completed ResultTask(0, 20)
> 14/04/16 12:02:15 INFO TaskSetManager: Finished TID 20 in 23529 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 2/32)
> 14/04/16 12:02:16 INFO DAGScheduler: Completed ResultTask(0, 26)
> 14/04/16 12:02:16 INFO TaskSetManager: Finished TID 26 in 24238 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 3/32)
> 14/04/16 12:02:16 INFO DAGScheduler: Completed ResultTask(0, 4)
> 14/04/16 12:02:16 INFO TaskSetManager: Finished TID 4 in 24929 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 4/32)
> 14/04/16 12:02:17 INFO DAGScheduler: Completed ResultTask(0, 2)
> 14/04/16 12:02:17 INFO TaskSetManager: Finished TID 2 in 25977 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 5/32)
> 14/04/16 12:02:18 INFO DAGScheduler: Completed ResultTask(0, 31)
> 14/04/16 12:02:18 INFO TaskSetManager: Finished TID 31 in 26453 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 6/32)
> 14/04/16 12:02:18 INFO DAGScheduler: Completed ResultTask(0, 5)
> 14/04/16 12:02:18 INFO TaskSetManager: Finished TID 5 in 26739 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 7/32)
> 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 12)
> 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 12 in 27342 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 8/32)
> 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 14)
> 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 14 in 27457 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 9/32)
> 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 8)
> 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 8 in 27604 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 10/32)
> 14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 10)
> 14/04/16 12:02:19 INFO TaskSetManager: Finished TID 10 in 27923 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 11/32)
> 14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 7)
> 14/04/16 12:02:20 INFO TaskSetManager: Finished TID 7 in 28544 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 12/32)
> 14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 27)
> 14/04/16 12:02:20 INFO TaskSetManager: Finished TID 27 in 28709 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 13/32)
> 14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 6)
> 14/04/16 12:02:20 INFO TaskSetManager: Finished TID 6 in 28965 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 14/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 0)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 0 in 29165 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 15/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 9)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 9 in 29256 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 16/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 13)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 13 in 29311 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 17/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 15)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 15 in 29378 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 18/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 11)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 11 in 29539 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 19/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 3)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 3 in 29608 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 20/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 1)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 1 in 29615 ms on
> brick10.ipads-lab.se.sjtu.edu.cn (progress: 21/32)
> 14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 22)
> 14/04/16 12:02:21 INFO TaskSetManager: Finished TID 22 in 29880 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 22/32)
> 14/04/16 12:02:22 INFO DAGScheduler: Completed ResultTask(0, 19)
> 14/04/16 12:02:22 INFO TaskSetManager: Finished TID 19 in 30727 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 23/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 18)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 18 in 31005 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 24/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 25)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 25 in 31013 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 25/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 28)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 28 in 31216 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 26/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 21)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 21 in 31259 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 27/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 30)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 30 in 31301 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 28/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 16)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 16 in 31439 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 29/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 29)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 29 in 31611 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 30/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 24)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 24 in 31824 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 31/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 17)
> 14/04/16 12:02:23 INFO TaskSetManager: Finished TID 17 in 31907 ms on
> brick11.ipads-lab.se.sjtu.edu.cn (progress: 32/32)
> 14/04/16 12:02:23 INFO DAGScheduler: Stage 0 (collect at Skyline.scala:79)
> finished in 33.984 s
> 14/04/16 12:02:23 INFO TaskSchedulerImpl: Removed TaskSet 0.0, whose tasks
> have all completed, from pool
> 14/04/16 12:02:23 INFO SparkContext: Job finished: collect at
> Skyline.scala:79, took 34.154637267 s
>
>
> Sorry if some of these questions are really trivial. Thanks for any
> explanations again.
>
> Yanzhe
>
> On Wednesday, April 16, 2014 at 1:37 AM, Cheng Lian wrote:
>
> Your Spark solution first reduces partial results into a single partition,
> computes the final result, and then collects to the driver side. This
> involves a shuffle and two waves of network traffic. Instead, you can
> directly collect partial results to the driver and then computes the final
> results on driver side:
>
> val data = sc.textFile(...).map(line => line.split(",").map(_.toDouble))val partialResults = data.mapPartitions(points => skyline(points.toArray).iterator).collect()val results = skyline(partialResults)
>
> On Wed, Apr 16, 2014 at 1:03 AM, Yanzhe Chen <ya...@gmail.com> wrote:
>
> Hi all,
>
> As a previous thread, I am asking how to implement a divide-and-conquer
> algorithm (skyline) in Spark.
> Here is my current solution:
>
> val data = sc.textFile(…).map(line => line.split(“,”).map(_.toDouble))
>
> val result = data.mapPartitions(points => *skyline*(points.toArray).iterator).coalesce(1,
> true)
> .mapPartitions(points => *skyline*
> (points.toArray).iterator).collect()
>
> where skyline is a local algorithm to compute the results:
>
> def *skyline*(points: Array[Point]) : Array[Point]
>
> Basically, I find this implement runs slower than the corresponding Hadoop
> version (the identity map phase plus local skyline for both combine and
> reduce phases).
>
> Below are my questions:
>
> 1. Why this implementation is much slower than the Hadoop one?
>
> I can find two possible reasons: one is the shuffle overhead in coalesce,
> another is calling the toArray and iterator repeatedly when invoking
> local skyline algorithm. But I am not sure which one is true.
>
> I haven’t seen your Hadoop version. But if this assumption is right, the
> above version should help.
>
>
> 2. One observation is that while Hadoop version almost used up all the CPU
> resources during execution, the CPU seems not that hot on Spark. Is that a
> clue to prove that the shuffling might be the real bottleneck?
>
> How many parallel tasks are there when running your Spark code? I doubt
> tasks are queued and run sequentially.
>
>
> 3. Is there any difference between coalesce(1, true) and reparation? It
> seems that both opeartions need shuffling data. What’s the proper
> situations using the coalesce method?
>
> repartition(n) is just an alias of coalesce(n, true), so yes, they both
> involve data shuffling. coalesce can be used to shrink partition number
> when dataset size shrinks dramatically after operations like filter. Say
> you have an RDD containing 1TB of data with 100 partitions, after a
> .filter(...) call, only 20GB data left, then you may want to coalesce to
> 2 partitions rather than 100.
>
>
> 4. More generally, I am trying to implementing some core geometry
> computation operators on Spark (like skyline, convex hull etc). In my
> understanding, since Spark is more capable of handling iterative
> computations on dataset, the above solution apparently doesn’t exploit what
> Spark is good at. Any comments on how to do geometry computations on Spark
> (if it is possible) ?
>
> Although Spark is good at iterative algorithms, it also performs better in
> batch computing due to much lower scheduling overhead and thread level
> parallelism. Theoretically, you can always accelerate your MapReduce job by
> rewriting it in Spark.
>
>
> Thanks for any insight.
>
> Yanzhe
>
>
>
Re: Why these operations are slower than the equivalent on
Hadoop?
Posted by Yanzhe Chen <ya...@gmail.com>.
Cheng,
Thanks for your explanation. I remove the coalesce part and the modification do improve the performance. But the result is still slower than the Hadoop version.
>
> How many parallel tasks are there when running your Spark code? I doubt tasks are queued and run sequentially.
>
>
>
I am not sure whether tasks are queued and run sequentially. I read the Level of Parallelism on Tuning Guide page and have several new questions:
> Clusters will not be fully utilized unless you set the level of parallelism for each operation high enough. Spark automatically sets the number of “map” tasks to run on each file according to its size (though you can control it through optional parameters to SparkContext.textFile, etc),
Does this mean if I call SparkContext.textFile(path, minSplit), then each file will be split into *minSplit* partitions? And if it is, say my input has 16 files, and minSplit is set to 2, does that mean Spark will generate 32 tasks if I call mapPartitions?
> and for distributed “reduce” operations, such as groupByKey and reduceByKey, it uses the largest parent RDD’s number of partitions. You can pass the level of parallelism as a second argument (see the spark.PairRDDFunctions (https://spark.apache.org/docs/0.9.0/api/core/index.html#org.apache.spark.rdd.PairRDDFunctions) documentation),
It seems that currently I don’t use any group operations so does this mean there are no distributed “reduce” operations in my code? Does collect operation belongs to “reduce” operation?
> or set the config property spark.default.parallelism to change the default. In general, we recommend 2-3 tasks per CPU core in your cluster.
If minSplit in SparkContext.textFile specify the parallelism on map side and PairRDDFunctions’s second argument controls the parallelism of reduce side. What spark.default.parallelism used for?
Besides, I pasted the LOG of my driver program here and can you tell the whether the tasks are queued and run sequentially?
I have a four-node cluster (brick10 - brick13) and each with 16-core and 64GB. And the parameters in the Tuning Guide are all set to default ( spark.default.parallelism = 8 and minSplit = 2). The input data is 1GB random generated points.
14/04/16 12:01:46 INFO SecurityManager: SecurityManager, is authentication enabled: false are ui acls enabled: false users with view permissions: Set(yanzhe)
14/04/16 12:01:47 INFO Slf4jLogger: Slf4jLogger started
14/04/16 12:01:47 INFO Remoting: Starting remoting
14/04/16 12:01:47 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://spark@brick5.ipads-lab.se.sjtu.edu.cn:49364]
14/04/16 12:01:47 INFO Remoting: Remoting now listens on addresses: [akka.tcp://spark@brick5.ipads-lab.se.sjtu.edu.cn:49364]
14/04/16 12:01:47 INFO SparkEnv: Registering BlockManagerMaster
14/04/16 12:01:47 INFO DiskBlockManager: Created local directory at /tmp/spark-local-20140416120147-d6a9
14/04/16 12:01:47 INFO MemoryStore: MemoryStore started with capacity 294.9 MB.
14/04/16 12:01:48 INFO ConnectionManager: Bound socket to port 44635 with id = ConnectionManagerId(brick5.ipads-lab.se.sjtu.edu.cn,44635)
14/04/16 12:01:48 INFO BlockManagerMaster: Trying to register BlockManager
14/04/16 12:01:48 INFO BlockManagerInfo: Registering block manager brick5.ipads-lab.se.sjtu.edu.cn:44635 with 294.9 MB RAM
14/04/16 12:01:48 INFO BlockManagerMaster: Registered BlockManager
14/04/16 12:01:48 INFO HttpServer: Starting HTTP Server
14/04/16 12:01:48 INFO HttpBroadcast: Broadcast server started at http://192.168.12.184:54396
14/04/16 12:01:48 INFO SparkEnv: Registering MapOutputTracker
14/04/16 12:01:48 INFO HttpFileServer: HTTP File server directory is /tmp/spark-75415972-fc25-4f12-a337-79abce06c085
14/04/16 12:01:48 INFO HttpServer: Starting HTTP Server
14/04/16 12:01:48 INFO SparkUI: Started Spark Web UI at http://brick5.ipads-lab.se.sjtu.edu.cn:4040
14/04/16 12:01:49 INFO SparkContext: Added JAR /home/yanzhe/gislib_2.10-0.1.jar at http://192.168.12.184:54005/jars/gislib_2.10-0.1.jar with timestamp 1397620909025
14/04/16 12:01:49 INFO AppClient$ClientActor: Connecting to master spark://brick5:7077...
14/04/16 12:01:49 INFO MemoryStore: ensureFreeSpace(56397) called with curMem=0, maxMem=309225062
14/04/16 12:01:49 INFO MemoryStore: Block broadcast_0 stored as values to memory (estimated size 55.1 KB, free 294.8 MB)
14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Connected to Spark cluster with app ID app-20140416120149-0162
14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added: app-20140416120149-0162/0 on worker-20140408030727-brick12.ipads-lab.se.sjtu.edu.cn-35300 (brick12.ipads-lab.se.sjtu.edu.cn:35300) with 16 cores
14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID app-20140416120149-0162/0 on hostPort brick12.ipads-lab.se.sjtu.edu.cn:35300 with 16 cores, 62.0 GB RAM
14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added: app-20140416120149-0162/1 on worker-20140408031122-brick11.ipads-lab.se.sjtu.edu.cn-53010 (brick11.ipads-lab.se.sjtu.edu.cn:53010) with 16 cores
14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID app-20140416120149-0162/1 on hostPort brick11.ipads-lab.se.sjtu.edu.cn:53010 with 16 cores, 62.0 GB RAM
14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added: app-20140416120149-0162/2 on worker-20140408030548-brick10.ipads-lab.se.sjtu.edu.cn-54839 (brick10.ipads-lab.se.sjtu.edu.cn:54839) with 16 cores
14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID app-20140416120149-0162/2 on hostPort brick10.ipads-lab.se.sjtu.edu.cn:54839 with 16 cores, 62.0 GB RAM
14/04/16 12:01:49 INFO AppClient$ClientActor: Executor added: app-20140416120149-0162/3 on worker-20140408030546-brick13.ipads-lab.se.sjtu.edu.cn-54297 (brick13.ipads-lab.se.sjtu.edu.cn:54297) with 16 cores
14/04/16 12:01:49 INFO SparkDeploySchedulerBackend: Granted executor ID app-20140416120149-0162/3 on hostPort brick13.ipads-lab.se.sjtu.edu.cn:54297 with 16 cores, 62.0 GB RAM
14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated: app-20140416120149-0162/0 is now RUNNING
14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated: app-20140416120149-0162/1 is now RUNNING
14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated: app-20140416120149-0162/3 is now RUNNING
14/04/16 12:01:49 INFO AppClient$ClientActor: Executor updated: app-20140416120149-0162/2 is now RUNNING
14/04/16 12:01:49 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
14/04/16 12:01:49 WARN LoadSnappy: Snappy native library not loaded
14/04/16 12:01:49 INFO FileInputFormat: Total input paths to process : 16
14/04/16 12:01:49 INFO SparkContext: Starting job: collect at Skyline.scala:79
14/04/16 12:01:49 INFO DAGScheduler: Got job 0 (collect at Skyline.scala:79) with 32 output partitions (allowLocal=false)
14/04/16 12:01:49 INFO DAGScheduler: Final stage: Stage 0 (collect at Skyline.scala:79)
14/04/16 12:01:49 INFO DAGScheduler: Parents of final stage: List()
14/04/16 12:01:49 INFO DAGScheduler: Missing parents: List()
14/04/16 12:01:49 INFO DAGScheduler: Submitting Stage 0 (MapPartitionsRDD[3] at mapPartitions at Skyline.scala:79), which has no missing parents
14/04/16 12:01:49 INFO DAGScheduler: Submitting 32 missing tasks from Stage 0 (MapPartitionsRDD[3] at mapPartitions at Skyline.scala:79)
14/04/16 12:01:49 INFO TaskSchedulerImpl: Adding task set 0.0 with 32 tasks
14/04/16 12:01:51 INFO SparkDeploySchedulerBackend: Registered executor: Actor[akka.tcp://sparkExecutor@brick10.ipads-lab.se.sjtu.edu.cn:35324/user/Executor#-869520545] with ID 2
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:0 as TID 0 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:0 as 1864 bytes in 7 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:1 as TID 1 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:1 as 1864 bytes in 0 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:2 as TID 2 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:2 as 1864 bytes in 0 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:3 as TID 3 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:3 as 1864 bytes in 0 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:4 as TID 4 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:4 as 1864 bytes in 0 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:5 as TID 5 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:5 as 1864 bytes in 0 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:6 as TID 6 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:6 as 1864 bytes in 1 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:7 as TID 7 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:7 as 1864 bytes in 1 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:8 as TID 8 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:8 as 1864 bytes in 1 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:9 as TID 9 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:9 as 1864 bytes in 1 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:10 as TID 10 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:10 as 1864 bytes in 1 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:11 as TID 11 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:11 as 1864 bytes in 1 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:12 as TID 12 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:12 as 1864 bytes in 0 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:13 as TID 13 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:13 as 1864 bytes in 1 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:14 as TID 14 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:14 as 1864 bytes in 0 ms
14/04/16 12:01:51 INFO TaskSetManager: Starting task 0.0:15 as TID 15 on executor 2: brick10.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:51 INFO TaskSetManager: Serialized task 0.0:15 as 1864 bytes in 0 ms
14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor: Actor[akka.tcp://sparkExecutor@brick11.ipads-lab.se.sjtu.edu.cn:60803/user/Executor#812944754] with ID 1
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:16 as TID 16 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:16 as 1864 bytes in 1 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:17 as TID 17 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:17 as 1864 bytes in 1 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:18 as TID 18 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:18 as 1864 bytes in 1 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:19 as TID 19 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:19 as 1864 bytes in 0 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:20 as TID 20 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:20 as 1864 bytes in 1 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:21 as TID 21 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:21 as 1864 bytes in 0 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:22 as TID 22 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:22 as 1864 bytes in 1 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:23 as TID 23 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:23 as 1864 bytes in 1 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:24 as TID 24 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:24 as 1864 bytes in 1 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:25 as TID 25 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:25 as 1864 bytes in 0 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:26 as TID 26 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:26 as 1864 bytes in 1 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:27 as TID 27 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:27 as 1864 bytes in 1 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:28 as TID 28 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:28 as 1864 bytes in 1 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:29 as TID 29 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:29 as 1864 bytes in 1 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:30 as TID 30 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:30 as 1864 bytes in 0 ms
14/04/16 12:01:52 INFO TaskSetManager: Starting task 0.0:31 as TID 31 on executor 1: brick11.ipads-lab.se.sjtu.edu.cn (PROCESS_LOCAL)
14/04/16 12:01:52 INFO TaskSetManager: Serialized task 0.0:31 as 1864 bytes in 0 ms
14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor: Actor[akka.tcp://sparkExecutor@brick13.ipads-lab.se.sjtu.edu.cn:57722/user/Executor#1718525013] with ID 3
14/04/16 12:01:52 INFO SparkDeploySchedulerBackend: Registered executor: Actor[akka.tcp://sparkExecutor@brick12.ipads-lab.se.sjtu.edu.cn:51585/user/Executor#-1756663662] with ID 0
14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager brick10.ipads-lab.se.sjtu.edu.cn:35695 with 35.7 GB RAM
14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager brick11.ipads-lab.se.sjtu.edu.cn:54679 with 35.7 GB RAM
14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager brick13.ipads-lab.se.sjtu.edu.cn:42178 with 35.7 GB RAM
14/04/16 12:01:52 INFO BlockManagerInfo: Registering block manager brick12.ipads-lab.se.sjtu.edu.cn:50560 with 35.7 GB RAM
14/04/16 12:02:14 INFO TaskSetManager: Finished TID 23 in 22711 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 1/32)
14/04/16 12:02:14 INFO DAGScheduler: Completed ResultTask(0, 23)
14/04/16 12:02:15 INFO DAGScheduler: Completed ResultTask(0, 20)
14/04/16 12:02:15 INFO TaskSetManager: Finished TID 20 in 23529 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 2/32)
14/04/16 12:02:16 INFO DAGScheduler: Completed ResultTask(0, 26)
14/04/16 12:02:16 INFO TaskSetManager: Finished TID 26 in 24238 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 3/32)
14/04/16 12:02:16 INFO DAGScheduler: Completed ResultTask(0, 4)
14/04/16 12:02:16 INFO TaskSetManager: Finished TID 4 in 24929 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 4/32)
14/04/16 12:02:17 INFO DAGScheduler: Completed ResultTask(0, 2)
14/04/16 12:02:17 INFO TaskSetManager: Finished TID 2 in 25977 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 5/32)
14/04/16 12:02:18 INFO DAGScheduler: Completed ResultTask(0, 31)
14/04/16 12:02:18 INFO TaskSetManager: Finished TID 31 in 26453 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 6/32)
14/04/16 12:02:18 INFO DAGScheduler: Completed ResultTask(0, 5)
14/04/16 12:02:18 INFO TaskSetManager: Finished TID 5 in 26739 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 7/32)
14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 12)
14/04/16 12:02:19 INFO TaskSetManager: Finished TID 12 in 27342 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 8/32)
14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 14)
14/04/16 12:02:19 INFO TaskSetManager: Finished TID 14 in 27457 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 9/32)
14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 8)
14/04/16 12:02:19 INFO TaskSetManager: Finished TID 8 in 27604 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 10/32)
14/04/16 12:02:19 INFO DAGScheduler: Completed ResultTask(0, 10)
14/04/16 12:02:19 INFO TaskSetManager: Finished TID 10 in 27923 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 11/32)
14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 7)
14/04/16 12:02:20 INFO TaskSetManager: Finished TID 7 in 28544 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 12/32)
14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 27)
14/04/16 12:02:20 INFO TaskSetManager: Finished TID 27 in 28709 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 13/32)
14/04/16 12:02:20 INFO DAGScheduler: Completed ResultTask(0, 6)
14/04/16 12:02:20 INFO TaskSetManager: Finished TID 6 in 28965 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 14/32)
14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 0)
14/04/16 12:02:21 INFO TaskSetManager: Finished TID 0 in 29165 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 15/32)
14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 9)
14/04/16 12:02:21 INFO TaskSetManager: Finished TID 9 in 29256 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 16/32)
14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 13)
14/04/16 12:02:21 INFO TaskSetManager: Finished TID 13 in 29311 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 17/32)
14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 15)
14/04/16 12:02:21 INFO TaskSetManager: Finished TID 15 in 29378 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 18/32)
14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 11)
14/04/16 12:02:21 INFO TaskSetManager: Finished TID 11 in 29539 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 19/32)
14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 3)
14/04/16 12:02:21 INFO TaskSetManager: Finished TID 3 in 29608 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 20/32)
14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 1)
14/04/16 12:02:21 INFO TaskSetManager: Finished TID 1 in 29615 ms on brick10.ipads-lab.se.sjtu.edu.cn (progress: 21/32)
14/04/16 12:02:21 INFO DAGScheduler: Completed ResultTask(0, 22)
14/04/16 12:02:21 INFO TaskSetManager: Finished TID 22 in 29880 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 22/32)
14/04/16 12:02:22 INFO DAGScheduler: Completed ResultTask(0, 19)
14/04/16 12:02:22 INFO TaskSetManager: Finished TID 19 in 30727 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 23/32)
14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 18)
14/04/16 12:02:23 INFO TaskSetManager: Finished TID 18 in 31005 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 24/32)
14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 25)
14/04/16 12:02:23 INFO TaskSetManager: Finished TID 25 in 31013 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 25/32)
14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 28)
14/04/16 12:02:23 INFO TaskSetManager: Finished TID 28 in 31216 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 26/32)
14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 21)
14/04/16 12:02:23 INFO TaskSetManager: Finished TID 21 in 31259 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 27/32)
14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 30)
14/04/16 12:02:23 INFO TaskSetManager: Finished TID 30 in 31301 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 28/32)
14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 16)
14/04/16 12:02:23 INFO TaskSetManager: Finished TID 16 in 31439 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 29/32)
14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 29)
14/04/16 12:02:23 INFO TaskSetManager: Finished TID 29 in 31611 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 30/32)
14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 24)
14/04/16 12:02:23 INFO TaskSetManager: Finished TID 24 in 31824 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 31/32)
14/04/16 12:02:23 INFO DAGScheduler: Completed ResultTask(0, 17)
14/04/16 12:02:23 INFO TaskSetManager: Finished TID 17 in 31907 ms on brick11.ipads-lab.se.sjtu.edu.cn (progress: 32/32)
14/04/16 12:02:23 INFO DAGScheduler: Stage 0 (collect at Skyline.scala:79) finished in 33.984 s
14/04/16 12:02:23 INFO TaskSchedulerImpl: Removed TaskSet 0.0, whose tasks have all completed, from pool
14/04/16 12:02:23 INFO SparkContext: Job finished: collect at Skyline.scala:79, took 34.154637267 s
Sorry if some of these questions are really trivial. Thanks for any explanations again.
Yanzhe
On Wednesday, April 16, 2014 at 1:37 AM, Cheng Lian wrote:
>
> Your Spark solution first reduces partial results into a single partition, computes the final result, and then collects to the driver side. This involves a shuffle and two waves of network traffic. Instead, you can directly collect partial results to the driver and then computes the final results on driver side:
>
> val data = sc.textFile(...).map(line => line.split(",").map(_.toDouble)) val partialResults = data.mapPartitions(points => skyline(points.toArray).iterator).collect() val results = skyline(partialResults)
>
> On Wed, Apr 16, 2014 at 1:03 AM, Yanzhe Chen <yanzhe.cn@gmail.com (mailto:yanzhe.cn@gmail.com)> wrote:
>
>
>
>
>
> > Hi all,
> >
> > As a previous thread, I am asking how to implement a divide-and-conquer algorithm (skyline) in Spark.
> > Here is my current solution:
> >
> > val data = sc.textFile(…).map(line => line.split(“,”).map(_.toDouble))
> >
> > val result = data.mapPartitions(points => skyline(points.toArray).iterator).coalesce(1, true)
> > .mapPartitions(points => skyline(points.toArray).iterator).collect()
> >
> > where skyline is a local algorithm to compute the results:
> >
> > def skyline(points: Array[Point]) : Array[Point]
> >
> > Basically, I find this implement runs slower than the corresponding Hadoop version (the identity map phase plus local skyline for both combine and reduce phases).
> >
> > Below are my questions:
> >
> > 1. Why this implementation is much slower than the Hadoop one?
> >
> > I can find two possible reasons: one is the shuffle overhead in coalesce, another is calling the toArray and iterator repeatedly when invoking local skyline algorithm. But I am not sure which one is true.
>
>
>
>
>
>
> I haven’t seen your Hadoop version. But if this assumption is right, the above version should help.
>
>
>
>
>
> >
> > 2. One observation is that while Hadoop version almost used up all the CPU resources during execution, the CPU seems not that hot on Spark. Is that a clue to prove that the shuffling might be the real bottleneck?
>
>
>
>
>
>
> How many parallel tasks are there when running your Spark code? I doubt tasks are queued and run sequentially.
>
>
>
>
>
> >
> > 3. Is there any difference between coalesce(1, true) and reparation? It seems that both opeartions need shuffling data. What’s the proper situations using the coalesce method?
>
>
>
>
>
>
> repartition(n) is just an alias of coalesce(n, true), so yes, they both involve data shuffling. coalesce can be used to shrink partition number when dataset size shrinks dramatically after operations like filter. Say you have an RDD containing 1TB of data with 100 partitions, after a .filter(...) call, only 20GB data left, then you may want to coalesce to 2 partitions rather than 100.
>
>
>
>
>
> >
> > 4. More generally, I am trying to implementing some core geometry computation operators on Spark (like skyline, convex hull etc). In my understanding, since Spark is more capable of handling iterative computations on dataset, the above solution apparently doesn’t exploit what Spark is good at. Any comments on how to do geometry computations on Spark (if it is possible) ?
>
>
>
>
>
>
> Although Spark is good at iterative algorithms, it also performs better in batch computing due to much lower scheduling overhead and thread level parallelism. Theoretically, you can always accelerate your MapReduce job by rewriting it in Spark.
>
>
>
>
>
> >
> > Thanks for any insight.
> >
> > Yanzhe
> >
>
>
>
>
>
>
>
Re: Why these operations are slower than the equivalent on Hadoop?
Posted by Cheng Lian <li...@gmail.com>.
Your Spark solution first reduces partial results into a single partition,
computes the final result, and then collects to the driver side. This
involves a shuffle and two waves of network traffic. Instead, you can
directly collect partial results to the driver and then computes the final
results on driver side:
val data = sc.textFile(...).map(line =>
line.split(",").map(_.toDouble))val partialResults =
data.mapPartitions(points =>
skyline(points.toArray).iterator).collect()val results =
skyline(partialResults)
On Wed, Apr 16, 2014 at 1:03 AM, Yanzhe Chen <ya...@gmail.com> wrote:
Hi all,
>
> As a previous thread, I am asking how to implement a divide-and-conquer
> algorithm (skyline) in Spark.
> Here is my current solution:
>
> val data = sc.textFile(…).map(line => line.split(“,”).map(_.toDouble))
>
> val result = data.mapPartitions(points => *skyline*(points.toArray).iterator).coalesce(1,
> true)
> .mapPartitions(points => *skyline*
> (points.toArray).iterator).collect()
>
> where skyline is a local algorithm to compute the results:
>
> def *skyline*(points: Array[Point]) : Array[Point]
>
> Basically, I find this implement runs slower than the corresponding Hadoop
> version (the identity map phase plus local skyline for both combine and
> reduce phases).
>
> Below are my questions:
>
> 1. Why this implementation is much slower than the Hadoop one?
>
> I can find two possible reasons: one is the shuffle overhead in coalesce,
> another is calling the toArray and iterator repeatedly when invoking
> local skyline algorithm. But I am not sure which one is true.
>
I haven’t seen your Hadoop version. But if this assumption is right, the
above version should help.
> 2. One observation is that while Hadoop version almost used up all the CPU
> resources during execution, the CPU seems not that hot on Spark. Is that a
> clue to prove that the shuffling might be the real bottleneck?
>
How many parallel tasks are there when running your Spark code? I doubt
tasks are queued and run sequentially.
> 3. Is there any difference between coalesce(1, true) and reparation? It
> seems that both opeartions need shuffling data. What’s the proper
> situations using the coalesce method?
>
repartition(n) is just an alias of coalesce(n, true), so yes, they both
involve data shuffling. coalesce can be used to shrink partition number
when dataset size shrinks dramatically after operations like filter. Say
you have an RDD containing 1TB of data with 100 partitions, after a
.filter(...) call, only 20GB data left, then you may want to coalesce to 2
partitions rather than 100.
> 4. More generally, I am trying to implementing some core geometry
> computation operators on Spark (like skyline, convex hull etc). In my
> understanding, since Spark is more capable of handling iterative
> computations on dataset, the above solution apparently doesn’t exploit what
> Spark is good at. Any comments on how to do geometry computations on Spark
> (if it is possible) ?
>
Although Spark is good at iterative algorithms, it also performs better in
batch computing due to much lower scheduling overhead and thread level
parallelism. Theoretically, you can always accelerate your MapReduce job by
rewriting it in Spark.
> Thanks for any insight.
>
> Yanzhe
>
>