<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vaibhav Shirpurkar</title>
    <description>The latest articles on DEV Community by Vaibhav Shirpurkar (@krillinkills).</description>
    <link>https://dev.to/krillinkills</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F900899%2F06b849b5-9b57-45b7-b45e-62a2d3138b81.jpg</url>
      <title>DEV Community: Vaibhav Shirpurkar</title>
      <link>https://dev.to/krillinkills</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/krillinkills"/>
    <language>en</language>
    <item>
      <title>Mastering Dynamic Allocation in Apache Spark: A Practical Guide with Real-World Insights</title>
      <dc:creator>Vaibhav Shirpurkar</dc:creator>
      <pubDate>Sun, 17 Nov 2024 15:26:11 +0000</pubDate>
      <link>https://dev.to/krillinkills/mastering-dynamic-allocation-in-apache-spark-a-practical-guide-with-real-world-insights-1ak4</link>
      <guid>https://dev.to/krillinkills/mastering-dynamic-allocation-in-apache-spark-a-practical-guide-with-real-world-insights-1ak4</guid>
      <description>&lt;h2&gt;
  
  
  Static Allocation: A Fixed Approach to Resource Management
&lt;/h2&gt;

&lt;p&gt;In static allocation, resources such as executors, CPU cores, and memory are manually specified when submitting a Spark job. These resources remain allocated for the application throughout its lifecycle, regardless of their actual utilization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How It Works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You configure resources using flags like --num-executors, --executor-memory, and --executor-cores.&lt;/li&gt;
&lt;li&gt;Spark reserves the defined resources for the application, making them unavailable to other jobs, even when idle.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Advantages:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Predictable Performance: Static allocation ensures consistent performance when workloads are well understood.&lt;/li&gt;
&lt;li&gt;Simplicity: Configuration is straightforward, making it ideal for environments with fixed resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Challenges:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resource Inefficiency: Static allocation can result in under-utilized resources during periods of low activity.&lt;/li&gt;
&lt;li&gt;Limited Scalability: Applications with variable workloads may experience performance bottlenecks or wasted resources.&lt;/li&gt;
&lt;li&gt;Increased Costs: Over-allocation of resources leads to unnecessary expense, especially in cloud environments.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Dynamic Allocation: Adapting to Workload Demands
&lt;/h2&gt;

&lt;p&gt;In dynamic allocation, Spark intelligently adjusts resources during the application’s runtime, scaling executors up or down based on workload requirements and cluster resource availability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How It Works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spark starts with minimal executors.&lt;/li&gt;
&lt;li&gt;Executors are added when the number of pending tasks increases.&lt;/li&gt;
&lt;li&gt;Idle executors are automatically removed after a specified timeout.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key Configurations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;spark.dynamicAllocation.enabled = true: Enables dynamic allocation.&lt;/li&gt;
&lt;li&gt;spark.dynamicAllocation.minExecutors: Sets the minimum number of executors.&lt;/li&gt;
&lt;li&gt;spark.dynamicAllocation.maxExecutors: Defines the upper limit for executors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Advantages:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resource Efficiency: Allocates resources only when needed, minimizing waste.&lt;/li&gt;
&lt;li&gt;Cost Savings: Reduces expenses by scaling down during periods of low demand.&lt;/li&gt;
&lt;li&gt;Flexibility: Adapts to workload fluctuations seamlessly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Challenges:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provisioning Delays: Scaling up executors introduces a slight delay.&lt;/li&gt;
&lt;li&gt;Cluster Manager Dependency: Requires support from cluster managers like YARN or Kubernetes.&lt;/li&gt;
&lt;li&gt;Misconfiguration Risks: Poor tuning of dynamic allocation parameters can impact performance or utilization&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Real-World Examples: Static vs. Dynamic Allocation
&lt;/h2&gt;

&lt;p&gt;Let’s illustrate the difference between static and dynamic allocation with a practical example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario: Static Allocation&lt;/strong&gt;&lt;br&gt;
Cluster Configuration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2 nodes, each with 8 cores and 8 GB of memory.&lt;/li&gt;
&lt;li&gt;Total available resources: 16 cores and 16 GB memory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Application 1 (App 1) Request:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;6 executors, each with 2 cores and 2 GB memory.&lt;/li&gt;
&lt;li&gt;Allocated Resources:

&lt;ul&gt;
&lt;li&gt;cores: 6*2 = 12&lt;/li&gt;
&lt;li&gt;Memory: 6*2GB = 12GB&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Remaining Resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cores: 16*12 = 4&lt;/li&gt;
&lt;li&gt;Memory: 16*12GB = 4GB&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tzjdaguur42bm0ohj9j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tzjdaguur42bm0ohj9j.png" alt="Image description" width="800" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Application 2 (App 2) Request:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;6 executors, each with 1 core and 1 GB memory.&lt;/li&gt;
&lt;li&gt;Required Resources:

&lt;ul&gt;
&lt;li&gt;cores: 6*2 = 12&lt;/li&gt;
&lt;li&gt;Memory: 6*2GB = 12GB&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7eqoatrl7746tnge3hrc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7eqoatrl7746tnge3hrc.png" alt="Image description" width="800" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since the cluster doesn’t have enough available resources, App 2 must wait for App 1 to complete, even if App 1 isn’t actively utilizing all its allocated resources.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Solution: Dynamic Allocation&lt;/strong&gt;&lt;br&gt;
With dynamic allocation, Spark can release idle resources from App 1, allowing App 2 to start immediately. This ensures optimal resource usage and reduces application wait times.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Static and dynamic allocation serve different purposes in Spark environments. While static allocation is simpler and predictable, it often results in resource inefficiency. Dynamic allocation, on the other hand, offers flexibility and cost savings, making it ideal for variable workloads.&lt;/p&gt;

&lt;p&gt;By enabling dynamic allocation, you can significantly improve cluster efficiency, minimize costs, and enhance application performance—especially in multi-tenant environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pro Tip:
&lt;/h2&gt;

&lt;p&gt;Always test and tune Spark configurations (e.g., timeout intervals, minimum executors) to align with your workload patterns and cluster capacity.&lt;/p&gt;

</description>
      <category>pyspark</category>
      <category>spark</category>
      <category>dataengineering</category>
      <category>data</category>
    </item>
    <item>
      <title>7 Useful Javascript utility liabraries should learn</title>
      <dc:creator>Vaibhav Shirpurkar</dc:creator>
      <pubDate>Tue, 16 Aug 2022 16:41:15 +0000</pubDate>
      <link>https://dev.to/krillinkills/7-useful-javascript-utility-liabraries-should-learn-35hf</link>
      <guid>https://dev.to/krillinkills/7-useful-javascript-utility-liabraries-should-learn-35hf</guid>
      <description>&lt;p&gt;I've Started React journey past 3 months. Since then I'm currently trying to improve my knowledge base by creating projects. While creating projects I realized knowing some basic liabraries would make life so much easy.&lt;br&gt;
So I've collected some useful liabraries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MathJS&lt;/strong&gt;&lt;br&gt;
-Math.js is an extensive math library for JavaScript and Node.js. It is compatible with JavaScript's built-in Math library.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Moment/date-fns&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;simplifies the JavaScript data manipulations by providing a variety of functions for parsing, validating, manipulating, and formatting dates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Sugar&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a Javascript utility library for working with native objects. Simple, straightforward API makes Sugar very easy to pick up and start using.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lazy.js&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;is a functional utility library for JavaScript, similar to Underscore and Lodash, but with a lazy engine under the hood that strives to do as little work as possible while being as flexible as possible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Underscore &amp;amp; Lodash&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;are great modern JavaScript utility libraries, and they are widely used by Front-end developers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Ramda&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;is designed specifically for a functional programming style, one that makes it easy to create functional pipelines, one that never mutates user data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;CollectJS&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;is the javascript library for collecting data from tree-based structures. This library is used on JavaScript Array and Objects.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>utility</category>
      <category>beginners</category>
      <category>react</category>
    </item>
    <item>
      <title>AI in javascript</title>
      <dc:creator>Vaibhav Shirpurkar</dc:creator>
      <pubDate>Thu, 11 Aug 2022 19:27:14 +0000</pubDate>
      <link>https://dev.to/krillinkills/ai-in-javascript-2bi9</link>
      <guid>https://dev.to/krillinkills/ai-in-javascript-2bi9</guid>
      <description>&lt;p&gt;I was a python developer so of-course I learned AI machine learning and deep learning. After that I also had interest in Web development&lt;br&gt;
so then I learns MERN stack  but now I started to enjoy Javascript and Typescript so I was wondering can I make machine learning models in Javascript?&lt;br&gt;
After some time I found Tensorflow is also available on Javascript ie. Tensorflow js. Tensorflow is a well Known liabrary in AI.&lt;br&gt;
Spending a good amount of time understanding Tensorflow from the core is a diffrent feeling. Then there is &lt;strong&gt;Brain.js&lt;/strong&gt; liabrary.&lt;br&gt;
by this i came across a lot of liabraries in Machine learning and AI&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Tensorflow js&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Brain.js&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ml5.js&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the language can be anything if you want to learn AI and execute it You can do it in probably any language easily.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
