cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Knowledge Sharing Hub
Dive into a collaborative space where members like YOU can exchange knowledge, tips, and best practices. Join the conversation today and unlock a wealth of collective wisdom to enhance your experience and drive success.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

What is Accumulators and Broadcast Variables

Yogic24
Valued Contributor II

1) Accumulators:
Accumulators are used to implement counters and sum in Spark applications.
Accumulators allow you to aggregate values from tasks running on worker nodes back to the driver program. They provide a way for tasks to incrementally update a shared variable (the accumulator) in a way that is safe for distributed computation. The driver program can then access the final value of the accumulator after all tasks have completed. (we have single copy on drive machine)

Conclusion : Accumulators are an important feature of Apache Spark that allows us to perform distributed calculations on large datasets. They provide a simple and efficient way of accumulating data across multiple tasks in a distributed system. By using accumulators in our Spark applications, we can perform complex calculations on large datasets with ease.

2) Broadcast :
The name suggest are โ€˜broadacastโ€™ to the nodes of the spark cluster to avoid shuffle operations. It allow you to efficiently distribute read-only data to all worker nodes in the cluster. This data is cached in memory on each worker node, so tasks can access it without having to transfer the data over the network repeatedly. Broadcast variables are particularly useful when you have large datasets or other read-only data that needs to be shared across tasks.
(we have separte copy on each machine)

Conclusion : The primary purpose of broadcast variables is to address the challenge of data replication and distribution in distributed systems. Instead of replicating large datasets across multiple nodes, which can be both time-consuming and resource-intensive, broadcast variables enable the efficient transfer of data to all the machines in the cluster. By doing so, broadcast variables eliminate the need for repetitive data transfers and improve the performance of distributed computations.

๐Ÿค Let's connect, engage, and grow together! I'm eager to hear your thoughts, experiences, and perspectives. Feel free to comment, share, and let's make this journey enriching for everyone.
๐Ÿ’ก Stay tuned for regular updates, and let's make our Community feed a place for inspiration and knowledge exchange!

#KnowledgeSharing #LearningAndDevelopment
#PersonalGrowth #SkillBuilding #ContinousLearning
#dataengineer #sparklearning

1 REPLY 1

Rishabh_Tiwari
Databricks Employee
Databricks Employee

Thank you for sharing this @Yogic24 . I am sure it will help other community members.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group