scala - SparkPi running slow with more than 1 slice -


Tried to run sparky examples on a new spark and a standalone 12 core three machine cluster. I have failed to understand that running this example with a slice gives better performance than using 12 slices. One such case was when I was using parallel function. Along with adding each slice, the time is almost nearly linear. Please tell me if I am doing something wrong code snippet is given below:

  val spark = new spark contact ("spark: // telecom: 7077", "sparky", system .getenv ("SPARK_HOME"), list ("target /scala-2.10/sparkpii_2.10-1.0.jar")) Val Slice = 1 Well N = 10000000 * Slice Val count = Spark. Parallel (1 to n, slice) .Map {i = & gt; Val x = random * 2 - 1 val y = random * 2 - 1 if (x * x + y * y & lt; 1) 1 and 0} .readuce (_ + _) println ("Pi roughly +" 4.0 * count / n) spark.stop ()   

UPDATE: The problem was random, because it was a synchronized method, it could not scale to many cores.

The random function used in sparky examples is a synchronized method and can not do multiple core scale. This is an easy enough example to deploy on your cluster, but do not use it to check spark performance and scalability.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -