Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-1813

Add a utility to SparkConf that makes using Kryo really easy

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0.0
    • 1.2.0
    • Spark Core
    • None

    Description

      It would be nice to have a method in SparkConf that makes it really easy to turn on Kryo serialization and register a set of classes.

      Using Kryo currently requires all this:

      import com.esotericsoftware.kryo.Kryo
      import org.apache.spark.serializer.KryoRegistrator
      
      class MyRegistrator extends KryoRegistrator {
        override def registerClasses(kryo: Kryo) {
          kryo.register(classOf[MyClass1])
          kryo.register(classOf[MyClass2])
        }
      }
      
      val conf = new SparkConf().setMaster(...).setAppName(...)
      conf.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
      conf.set("spark.kryo.registrator", "mypackage.MyRegistrator")
      val sc = new SparkContext(conf)
      

      It would be nice if it just required this:

      SparkConf.setKryo(Array(classOf[MyClass1], classOf[MyClass2]))
      

      Attachments

        Issue Links

          Activity

            People

              sandyr Sandy Ryza
              sandyr Sandy Ryza
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: