[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-24 Thread techaddict
Github user techaddict commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-221259367
  
cc: @srowen @rxin @JoshRosen 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-13 Thread techaddict
Github user techaddict commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-219031508
  
ping @rxin @JoshRosen @andrewor14 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-07 Thread techaddict
Github user techaddict commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217656238
  
@JoshRosen @rxin can you review this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-05 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217117020
  
Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-05 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217117021
  
Test PASSed.
Refer to this link for build results (access rights to CI server needed): 
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/57862/
Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-05 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217116869
  
**[Test build #57862 has 
finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57862/consoleFull)**
 for PR 12913 at commit 
[`112497b`](https://github.com/apache/spark/commit/112497b9f565d9f2a9429ad05e5f49d1b0b285a1).
 * This patch passes all tests.
 * This patch merges cleanly.
 * This patch adds the following public classes _(experimental)_:
  * `class KryoBenchmark extends SparkFunSuite `


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-05 Thread techaddict
Github user techaddict commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217100211
  
@rxin figured out the problem, was using `var N` and its value was changed 
before the benchmark ran so each benchmark was running effectvely for `N=5000`, 
thus giving an impression of dead code elimination.
Plus I was passing function to kryo instead of value in one of the cases, 
so that was also just wrong.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-05 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217100209
  
**[Test build #57862 has 
started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57862/consoleFull)**
 for PR 12913 at commit 
[`112497b`](https://github.com/apache/spark/commit/112497b9f565d9f2a9429ad05e5f49d1b0b285a1).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-04 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217047700
  
Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-04 Thread rxin
Github user rxin commented on a diff in the pull request:

https://github.com/apache/spark/pull/12913#discussion_r62137117
  
--- Diff: 
core/src/test/scala/org/apache/spark/scheduler/KryoBenchmark.scala ---
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.scheduler
+
+import scala.reflect.ClassTag
+import scala.util.Random
+
+import org.apache.spark.{SharedSparkContext, SparkFunSuite}
+import org.apache.spark.serializer.KryoSerializer
+import org.apache.spark.serializer.KryoTest._
+import org.apache.spark.util.Benchmark
+
+class KryoBenchmark extends SparkFunSuite with SharedSparkContext {
+  conf.set("spark.serializer", 
"org.apache.spark.serializer.KryoSerializer")
+  conf.set("spark.kryo.registrator", classOf[MyRegistrator].getName)
+
+  val benchmark = new Benchmark("Benchmark Kryo Unsafe vs safe 
Serialization", 1024 * 1024 * 15, 10)
+
+  test(s"Benchmark Kryo Unsafe vs safe Serialization") {
+Seq (false, true).foreach (runBenchmark)
+benchmark.run()
+
+// scalastyle:off
+/*
+  Java HotSpot(TM) 64-Bit Server VM 1.8.0_60-b27 on Mac OS X 10.11.4
+  Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
+
+  Benchmark Kryo Unsafe vs safe Serialization: Best/Avg Time(ms)
Rate(M/s)   Per Row(ns)   Relative
+  

+  basicTypes: Int unsafe:false 2 /4   
8988.0   0.1   1.0X
+  basicTypes: Long unsafe:false1 /1  
13981.3   0.1   1.6X
+  basicTypes: Float unsafe:false   1 /1  
14460.6   0.1   1.6X
+  basicTypes: Double unsafe:false  1 /1  
15876.9   0.1   1.8X
+  Array: Int unsafe:false 33 /   44
474.8   2.1   0.1X
+  Array: Long unsafe:false18 /   25
888.6   1.1   0.1X
+  Array: Float unsafe:false   10 /   16   
1627.4   0.6   0.2X
+  Array: Double unsafe:false  10 /   13   
1523.1   0.7   0.2X
+  Map of string->Double unsafe:false 413 /  447 
38.1  26.3   0.0X
+  basicTypes: Int unsafe:true  1 /1  
16402.6   0.1   1.8X
+  basicTypes: Long unsafe:true 1 /1  
19732.1   0.1   2.2X
+  basicTypes: Float unsafe:true1 /1  
19752.9   0.1   2.2X
+  basicTypes: Double unsafe:true   1 /1  
23111.4   0.0   2.6X
+  Array: Int unsafe:true   7 /8   
2239.9   0.4   0.2X
+  Array: Long unsafe:true  8 /9   
2000.1   0.5   0.2X
+  Array: Float unsafe:true 7 /8   
2191.5   0.5   0.2X
+  Array: Double unsafe:true9 /   10   
1841.2   0.5   0.2X
+  Map of string->Double unsafe:true  387 /  407 
40.7  24.6   0.0X
+*/
+// scalastyle:on
+  }
+
+  private def runBenchmark(useUnsafe: Boolean): Unit = {
+conf.set("spark.kryo.useUnsafe", useUnsafe.toString)
+val ser = new KryoSerializer(conf).newInstance()
+
+def addBenchmark(name: String, values: Long)(f: => Long): Unit = {
+  benchmark.addCase(s"$name unsafe:$useUnsafe") { iters =>
+f + 1
+  }
+}
+
+def check[T: ClassTag](t: T): Int = {
+  if (ser.deserialize[T](ser.serialize(t)) === t) 1 else 0
+}
+
+var N = 500
+basicTypes("Int", Random.nextInt)
+basicTypes("Long", Random.nextLong)
+

[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-04 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217047701
  
Test PASSed.
Refer to this link for build results (access rights to CI server needed): 
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/57811/
Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-04 Thread rxin
Github user rxin commented on a diff in the pull request:

https://github.com/apache/spark/pull/12913#discussion_r62137084
  
--- Diff: 
core/src/test/scala/org/apache/spark/scheduler/KryoBenchmark.scala ---
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.scheduler
+
+import scala.reflect.ClassTag
+import scala.util.Random
+
+import org.apache.spark.{SharedSparkContext, SparkFunSuite}
+import org.apache.spark.serializer.KryoSerializer
+import org.apache.spark.serializer.KryoTest._
+import org.apache.spark.util.Benchmark
+
+class KryoBenchmark extends SparkFunSuite with SharedSparkContext {
+  conf.set("spark.serializer", 
"org.apache.spark.serializer.KryoSerializer")
+  conf.set("spark.kryo.registrator", classOf[MyRegistrator].getName)
+
+  val benchmark = new Benchmark("Benchmark Kryo Unsafe vs safe 
Serialization", 1024 * 1024 * 15, 10)
+
+  test(s"Benchmark Kryo Unsafe vs safe Serialization") {
+Seq (false, true).foreach (runBenchmark)
+benchmark.run()
+
+// scalastyle:off
+/*
+  Java HotSpot(TM) 64-Bit Server VM 1.8.0_60-b27 on Mac OS X 10.11.4
+  Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
+
+  Benchmark Kryo Unsafe vs safe Serialization: Best/Avg Time(ms)
Rate(M/s)   Per Row(ns)   Relative
+  

+  basicTypes: Int unsafe:false 2 /4   
8988.0   0.1   1.0X
--- End diff --

this benchmark is probably wrong. these numbers don't make sense.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-04 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217047594
  
**[Test build #57811 has 
finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57811/consoleFull)**
 for PR 12913 at commit 
[`5641367`](https://github.com/apache/spark/commit/5641367687760fcc2799a4cfe849d4bc9726f36b).
 * This patch passes all tests.
 * This patch merges cleanly.
 * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-04 Thread techaddict
Github user techaddict commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217034618
  
@vectorijk The class Kryo Serializer is not wire-compatible, so IMO we 
should be ok. Either one uses Unsafe or safe based at a time.
Comment from the KryoSerializer class
```Note that this serializer is not guaranteed to be wire-compatible across 
different versions of
  Spark. It is intended to be used to serialize/de-serialize data within a 
single
  Spark application.```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-04 Thread vectorijk
Github user vectorijk commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217031852
  
@techaddict According to 
[this](https://github.com/EsotericSoftware/kryo#-disclaimer-about-using-unsafe-based-io-),
 I am just wondering what will happen when Unsafe-based IO is not compatible 
with Kryo's Input and Output streams.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-04 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/12913#issuecomment-217026635
  
**[Test build #57811 has 
started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57811/consoleFull)**
 for PR 12913 at commit 
[`5641367`](https://github.com/apache/spark/commit/5641367687760fcc2799a4cfe849d4bc9726f36b).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-928][CORE] Add support for Unsafe-based...

2016-05-04 Thread techaddict
GitHub user techaddict opened a pull request:

https://github.com/apache/spark/pull/12913

[SPARK-928][CORE] Add support for Unsafe-based serializer in Kryo

## What changes were proposed in this pull request?
Now since we have migrated to Kryo-3.0.0 in 
https://issues.apache.org/jira/browse/SPARK-11416, we can gives users option to 
use unsafe SerDer. It can turned by setting `spark.kryo.useUnsafe` to `true`

## How was this patch tested?
Ran existing tests

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/techaddict/spark SPARK-928

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/12913.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #12913


commit 5641367687760fcc2799a4cfe849d4bc9726f36b
Author: Sandeep Singh 
Date:   2016-05-01T16:11:33Z

[SPARK-928][CORE] Add support for Unsafe-based serializer in Kryo




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org