Skip to content
Gold 7 min read · spark.serializer 2 practice problems ↓

Serialization: Java, Kryo, Tungsten and Arrow

Where Spark serializes data and code, and which serializer matters for RDDs, DataFrames and Python.

Step 2 · Spark internals · Gold · Under the hood, lesson 5 of 5

Read first: RDDs, DataFrames and Datasets · The memory model (skip if you know them)

In plain words first

Posting a bookshelf, you take it apart, pack the pieces flat and include instructions; the receiver builds it again. Packing and unpacking takes time, and a smart flat-pack is much faster than wrapping the whole shelf.

Serialization is the packing: turning objects into bytes so they can travel or be stored, and back again at the other end.

Unlock the full lesson

You have read the free part. The rest of this advanced lesson:

  • Where serialization happens
  • Why DataFrames mostly do not care
  • Java vs Kryo for RDDs
  • Task not serializable
  • Arrow for Python
  • Try it yourself
  • Common mistakes
  • Key takeaways
  • Interview prep with 3 follow-up questions
  • Check yourself: 3 questions

Unlock it with the Complete pass (every advanced problem and lesson) or on its own.

Practise this

Interview problems on spark performance, graded on hidden tests

Keep going

Up next · new module: Layout tricks · 6 min read
Dynamic partition pruning
Skip whole partitions of a fact table at runtime using a filter on the dimension it joins to.

Related lessons

Previous: How aggregations execute

Primary sources: Tuning: data serialization · Apache Arrow in PySpark