Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Optimizing Databricks Workloads

You're reading from  Optimizing Databricks Workloads

Product type Book
Published in Dec 2021
Publisher Packt
ISBN-13 9781801819077
Pages 230 pages
Edition 1st Edition
Languages
Authors (3):
Anirudh Kala Anirudh Kala
Profile icon Anirudh Kala
Anshul Bhatnagar Anshul Bhatnagar
Profile icon Anshul Bhatnagar
Sarthak Sarbahi Sarthak Sarbahi
Profile icon Sarthak Sarbahi
View More author details

Table of Contents (13) Chapters

Preface Section 1: Introduction to Azure Databricks
Chapter 1: Discovering Databricks Chapter 2: Batch and Real-Time Processing in Databricks Chapter 3: Learning about Machine Learning and Graph Processing in Databricks Section 2: Optimization Techniques
Chapter 4: Managing Spark Clusters Chapter 5: Big Data Analytics Chapter 6: Databricks Delta Lake Chapter 7: Spark Core Section 3: Real-World Scenarios
Chapter 8: Case Studies Other Books You May Enjoy

Understanding shuffle partitions

Every time Spark performs a wide transformation or aggregations, shuffling of data across the nodes occurs. And during these shuffle operations, Spark, by default, changes the partitions of the DataFrame. For example, when creating a DataFrame, it may have 10 partitions, but as soon as the shuffle occurs, Spark may change the partitions of the DataFrame to 200. These are what we call the shuffle partitions.

This is a default behavior in Spark, but it can be altered to improve the performance of Spark jobs. We can also confirm the default behavior by running the following line of code:

spark.conf.get('spark.sql.shuffle.partitions')

This returns the output of 200. This means that Spark will change the shuffle partitions to 200 by default. To alter this configuration, we can run the following code, which configures the shuffle partitions to 8:

spark.conf.set('spark.sql.shuffle.partitions',8)

You may be wondering why we...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}