Skip to content

Commit

Permalink
make default for kryo max buffer size 16MB
Browse files Browse the repository at this point in the history
  • Loading branch information
koertkuipers committed May 14, 2014
1 parent 143ec4d commit 0c9f8eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class KryoSerializer(conf: SparkConf)
with Logging
with Serializable {

private val bufferSizeMb = conf.getInt("spark.kryoserializer.buffer.mb", 2)
private val maxBufferSizeMb = conf.getInt("spark.kryoserializer.buffer.max.mb", bufferSizeMb)
private val bufferSize = conf.getInt("spark.kryoserializer.buffer.mb", 2) * 1024 * 1024
private val maxBufferSize = conf.getInt("spark.kryoserializer.buffer.max.mb", 16) * 1024 * 1024
private val referenceTracking = conf.getBoolean("spark.kryo.referenceTracking", true)
private val registrator = conf.getOption("spark.kryo.registrator")

def newKryoOutput() = new KryoOutput(bufferSizeMb * 1024 * 1024, maxBufferSizeMb * 1024 * 1024)
def newKryoOutput() = new KryoOutput(bufferSize, math.max(bufferSize, maxBufferSize))

def newKryo(): Kryo = {
val instantiator = new EmptyScalaKryoInstantiator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class KryoSerializerResizableOutputSuite extends FunSuite {
val conf = new SparkConf(false)
conf.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
conf.set("spark.kryoserializer.buffer.mb", "1")
conf.set("spark.kryoserializer.buffer.max.mb", "1")
val sc = new SparkContext("local", "test", conf)
intercept[SparkException](sc.parallelize(x).collect)
LocalSparkContext.stop(sc)
Expand Down

0 comments on commit 0c9f8eb

Please sign in to comment.