<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abhishek Muni on Medium]]></title>
        <description><![CDATA[Stories by Abhishek Muni on Medium]]></description>
        <link>https://medium.com/@amuni?source=rss-4b154a4ddf31------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qgMr4QLYcfaSB7iYLL8A4g@2x.jpeg</url>
            <title>Stories by Abhishek Muni on Medium</title>
            <link>https://medium.com/@amuni?source=rss-4b154a4ddf31------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 09:53:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amuni/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Put It Early, Play It Late — ETL vs. ELT in Data Processing ]]></title>
            <link>https://medium.com/@amuni/put-it-early-play-it-late-etl-vs-elt-in-data-processing-5c483670b471?source=rss-4b154a4ddf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c483670b471</guid>
            <dc:creator><![CDATA[Abhishek Muni]]></dc:creator>
            <pubDate>Mon, 10 Mar 2025 10:57:09 GMT</pubDate>
            <atom:updated>2025-03-10T10:57:09.755Z</atom:updated>
            <content:encoded><![CDATA[<h3>Put It Early, Play It Late — ETL vs. ELT in Data Processing 🎭</h3><h3>Introduction</h3><p>In the world of data engineering, <strong>ETL (Extract, Transform, Load) and ELT (Extract, Load, Transform)</strong> are two primary approaches to processing data for analytics and reporting. While <strong>ETL</strong> has been the traditional method used for decades, <strong>ELT</strong> has emerged as a more efficient and scalable alternative, especially with the rise of <strong>cloud data warehouses</strong> like Snowflake, BigQuery, and Redshift. This article breaks down <strong>the differences, use cases, advantages, and challenges</strong> of ETL and ELT, helping you choose the right approach for your data architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*uUPAI-AX0OnRJGcf1334lA.gif" /><figcaption><a href="https://www.linkedin.com/posts/skphd_etl-elt-data-activity-7279255885795807233-8ocb?utm_source=share&amp;utm_medium=member_desktop&amp;rcm=ACoAACZZ2wgBI0XUeTLDzg6ssp_0el0IKXLdFj8">Image reference</a></figcaption></figure><h3>1. What is ETL?</h3><h3>🔹 Definition</h3><p>ETL stands for <strong>Extract, Transform, Load</strong>, where:</p><ul><li><strong>Extract</strong>: Data is pulled from various sources (databases, APIs, files, etc.).</li><li><strong>Transform</strong>: Data is cleaned, enriched, and structured <strong>before loading</strong>.</li><li><strong>Load</strong>: The transformed data is then stored in a <strong>data warehouse</strong> or <strong>database</strong>.</li></ul><h3>🛠️ ETL Workflow Example</h3><ol><li>Extract <strong>sales data</strong> from an <strong>ERP system</strong>.</li><li>Transform: Convert currency, filter invalid records, and apply aggregations.</li><li>Load the cleaned data into <strong>Snowflake</strong> for reporting.</li></ol><h3>✅ Advantages of ETL</h3><ul><li><strong>Ensures clean and structured data</strong> before loading.</li><li><strong>Optimized for traditional databases</strong> that may struggle with raw data.</li><li><strong>Better for on-premise systems</strong> where storage and compute are expensive.</li></ul><h3>❌ Challenges of ETL</h3><ul><li><strong>Processing bottlenecks</strong>: Transforming data <strong>before loading</strong> can be slow.</li><li><strong>Not scalable</strong> for modern big data applications.</li><li><strong>High upfront processing costs</strong> before insights can be generated.</li></ul><h3>2. What is ELT?</h3><h3>🔹 Definition</h3><p>ELT stands for <strong>Extract, Load, Transform</strong>, where:</p><ul><li><strong>Extract</strong>: Data is pulled from sources <strong>without modification</strong>.</li><li><strong>Load</strong>: Raw data is loaded <strong>directly into the data warehouse</strong>.</li><li><strong>Transform</strong>: Data is processed <strong>inside the data warehouse</strong> using SQL or cloud-native processing tools.</li></ul><h3>🛠️ ELT Workflow Example</h3><ol><li>Extract raw customer transactions from <strong>a retail website</strong>.</li><li>Load raw JSON/CSV files <strong>directly into Snowflake or BigQuery</strong>.</li><li>Transform the data using <strong>SQL queries or dbt (data build tool)</strong> for reporting.</li></ol><h3>✅ Advantages of ELT</h3><ul><li><strong>Faster data ingestion</strong> since transformation happens <strong>after loading</strong>.</li><li><strong>Scalable with cloud data warehouses</strong> that optimize compute and storage.</li><li><strong>Enables real-time analytics</strong> by keeping raw data available for quick processing.</li></ul><h3>❌ Challenges of ELT</h3><ul><li><strong>Requires a powerful data warehouse</strong> capable of handling transformations.</li><li><strong>Data governance complexity</strong>: Storing raw data means extra compliance considerations.</li><li><strong>More storage consumption</strong> due to keeping raw and transformed data.</li></ul><h3>3. Key Differences Between ETL and ELT</h3><p>To better understand <strong>ETL vs. ELT</strong>, let’s take a real-world example: <strong>baking a cake for a special occasion</strong>. The process involves <strong>gathering ingredients, mixing, baking, and final presentation</strong>, just like how data moves through an ETL or ELT pipeline.</p><h3>🎂 ETL Approach: Preparing the Cake Before Serving</h3><ul><li><strong>Extract</strong>: The baker gathers all ingredients, pre-measured and sorted.</li><li><strong>Transform</strong>: The ingredients are mixed, the batter is baked, and the cake is fully decorated before being presented.</li><li><strong>Load</strong>: The finished cake is delivered to the customer, ready to eat.</li></ul><p>🔹 <strong>How this relates to ETL:</strong></p><ul><li>The <strong>transformation (mixing &amp; baking)</strong> happens before the final product is delivered.</li><li>The customer only receives a <strong>fully processed cake (structured, cleaned data)</strong>.</li><li>Best when <strong>strict quality control and presentation</strong> are important before serving.</li></ul><h3>🚀 ELT Approach: Delivering Ingredients First, Assembling Later</h3><ul><li><strong>Extract</strong>: The baker collects all ingredients (flour, eggs, sugar, frosting, etc.).</li><li><strong>Load</strong>: Instead of baking beforehand, the ingredients are <strong>delivered directly to the customer’s kitchen</strong>.</li><li><strong>Transform</strong>: The customer mixes, bakes, and decorates the cake according to their preference.</li></ul><p>🔹 <strong>How this relates to ELT:</strong></p><ul><li>The <strong>transformation (baking &amp; decorating) happens after delivery</strong>.</li><li>Customers can <strong>customize their cake later</strong> (raw data remains available for different transformations).</li><li>Best when <strong>flexibility and real-time adjustments</strong> are important.</li></ul><p>In the <strong>first approach</strong>, you receive a <strong>ready-made product</strong>, crafted to <strong>perfection</strong> with minimal deviations, following the <strong>standards set by the baker’s brand</strong>. In the <strong>second approach</strong>, delivery is <strong>faster</strong>, offering <strong>more flexibility</strong> and room for creativity. But <strong>without proper planning and skills</strong>, it could easily turn into a <strong>disaster — just like Rachel’s Thanksgiving trifle!</strong> 🍰😬</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*ygyN-sFeUuBlKqSk.gif" /></figure><p>Here are some of the differences in the features in both the approaches-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KSnLIMQ4ZQoj1tDHbz8wmQ.png" /></figure><h3>4. When to Use ETL vs. ELT?</h3><h3>✅ Use ETL When:</h3><ul><li>You have <strong>strict data quality requirements</strong> before storage.</li><li>Your infrastructure is <strong>on-premise or traditional relational databases</strong>.</li><li>You work with <strong>structured data and predefined schemas</strong>.</li></ul><h3>✅ Use ELT When:</h3><ul><li>You use <strong>cloud-native data warehouses</strong> like <strong>Snowflake, BigQuery, or Redshift</strong>.</li><li>You need <strong>real-time analytics</strong> and <strong>faster ingestion</strong>.</li><li>Your data is <strong>semi-structured (JSON, Avro, Parquet)</strong> and needs flexibility.</li></ul><h3>5. Real-World Scenarios: When to Use ETL, ELT, or a Hybrid Approach?</h3><p>Understanding when to use ETL, ELT, or a hybrid approach depends on the <strong>size, nature of data, and the data warehouse infrastructure</strong>. Below are <strong>real-world scenarios</strong> to illustrate the best approach in each case.</p><h3>📌 Scenario 1: Financial Data Processing (ETL Preferred)</h3><ul><li><strong>Size &amp; Nature of Data</strong>: Structured financial transactions (~1TB/day) from an <strong>on-premise relational database</strong>.</li><li><strong>Data Warehouse</strong>: Oracle or SQL Server.</li><li><strong>Problem Statement</strong>: The organization must ensure <strong>strict data quality, compliance, and pre-validated transformations</strong> before storage.</li><li><strong>Why ETL?</strong></li><li>✅ Sensitive data can be <strong>validated, cleaned, and masked</strong> before reaching storage.</li><li>✅ <strong>Data governance and compliance</strong> are easier to enforce.</li><li>✅ On-premise databases <strong>lack scalable transformation capabilities</strong> after loading.</li></ul><h3>📌 Scenario 2: E-commerce Analytics (ELT Preferred)</h3><ul><li><strong>Size &amp; Nature of Data</strong>: Large-scale <strong>clickstream data, customer transactions, and product catalogs (~5TB/day)</strong>.</li><li><strong>Data Warehouse</strong>: Google BigQuery.</li><li><strong>Problem Statement</strong>: The company wants to <strong>analyze real-time customer behavior</strong>, running fast ad-hoc queries on semi-structured data.</li><li><strong>Why ELT?</strong></li><li>✅ Faster ingestion into BigQuery without transformation delays.</li><li>✅ Uses <strong>BigQuery’s native SQL processing power</strong> to transform data efficiently.</li><li>✅ Can store <strong>raw data for historical analysis</strong> without loss.</li></ul><h3>📌 Scenario 3: Healthcare Data Integration (Hybrid ETL + ELT)</h3><ul><li><strong>Size &amp; Nature of Data</strong>: Patient records (~500GB/day) + real-time medical device logs (~2TB/day).</li><li><strong>Data Warehouse</strong>: Snowflake.</li><li><strong>Problem Statement</strong>: The organization needs <strong>accurate patient data for compliance</strong>, while keeping <strong>raw sensor logs for predictive modeling</strong>.</li><li><strong>Why Hybrid?</strong></li><li>✅ <strong>ETL for patient records</strong> to ensure strict validation and compliance before loading.</li><li>✅ <strong>ELT for sensor data</strong>, loading raw logs into Snowflake, then transforming only relevant fields for analysis.</li></ul><p>While ELT is gaining popularity, <strong>many organizations use a hybrid approach</strong>, where:</p><ul><li><strong>ETL is used for high-quality, structured datasets</strong>.</li><li><strong>ELT is used for raw, flexible, and large-scale analytics</strong>.</li></ul><p>Technologies like <strong>Apache Spark, dbt, and Airflow</strong> are making it easier to combine both methods efficiently.</p><h3>Conclusion</h3><p>Both <strong>ETL and ELT have their place</strong> in modern data processing. Choosing between them depends on <strong>your data infrastructure, scalability needs, and performance considerations</strong>. With the rise of <strong>cloud data warehouses</strong>, ELT is becoming the preferred approach, but <strong>ETL remains valuable for structured enterprise data processing</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c483670b471" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DuckDB + Smallpond vs. PySpark: A New Challenger in Distributed Compute?]]></title>
            <link>https://medium.com/@amuni/duckdb-smallpond-vs-pyspark-a-new-challenger-in-distributed-compute-cc884b4010e4?source=rss-4b154a4ddf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc884b4010e4</guid>
            <dc:creator><![CDATA[Abhishek Muni]]></dc:creator>
            <pubDate>Mon, 03 Mar 2025 06:12:25 GMT</pubDate>
            <atom:updated>2025-03-03T06:12:25.872Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*hgBGFBMp-vWzlXMgOg7OfQ.png" /></figure><h3>Introduction</h3><p>When it comes to distributed data processing, Apache Spark (PySpark) has been the dominant force, offering scalability, resilience, and a mature ecosystem. However, DeepSeek’s Smallpond, an innovative distributed compute framework built on DuckDB, is making waves in the analytics world by pushing DuckDB beyond its single-node limitations.This article compares DuckDB + Smallpond with PySpark, analyzing their architectures, strengths, weaknesses, and best use cases.</p><h3>Why DuckDB Matters</h3><p><strong>1.GitHub Stars Trend:</strong> The repository’s star rating has been sky rocketing over the years with current over 25000 ratings, indicating strong community adoption and interest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*RJC28BsMPSOhKxd93dT5Sw.png" /></figure><p><strong>2.DeepSeek Collaboration:</strong> DeepSeek has integrated DuckDB into its <strong>Smallpond</strong> project, transforming it into a <strong>scalable, distributed platform</strong> for high-performance analytics.</p><p><strong>3.Hugging Face Partnership:</strong> Hugging Face has been leveraging DuckDB for <strong>dataset exploration and efficient querying</strong>, integrating it within their dataset viewer for rapid access to large AI datasets.</p><h3>🚀 Why It’s a Game Changer</h3><p>✅ <strong>Speed &amp; Efficiency:</strong> Runs analytical queries significantly faster than traditional databases.<br>✅ <strong>Embedded &amp; Serverless:</strong> No need for external infrastructure — works within applications.<br>✅ <strong>Growing Ecosystem:</strong> Integration with Pandas, Polars, Arrow, and cloud storage providers like S3 and GCS.<br>✅ <strong>Now Distributed:</strong> With <strong>Smallpond</strong>, DuckDB breaks its single-node limitation, competing with distributed frameworks like Spark.</p><h3>Understanding DuckDB’s In-Memory Processing and Evolution</h3><h3>🔹 How DuckDB Handles In-Memory Processing</h3><p>DuckDB is designed as an <strong>in-process, columnar analytical database</strong> optimized for <strong>fast, single-node analytics</strong>. Unlike traditional databases that rely on disk-based processing, DuckDB primarily operates <strong>in-memory</strong>, making it significantly faster for analytical workloads.</p><p><strong>Key components of DuckDB’s in-memory execution:</strong></p><ul><li><strong>Columnar Storage</strong>: Instead of row-based storage (like PostgreSQL), DuckDB stores data in columns, improving query performance for analytical workloads.</li><li><strong>Vectorized Execution</strong>: DuckDB processes data in small chunks (<strong>vectors</strong>) instead of row-by-row, reducing CPU cache misses and improving throughput.</li><li><strong>Memory Management</strong>: DuckDB uses <strong>adaptive memory allocation</strong> to optimize joins, aggregations, and sorting without excessive memory consumption.</li></ul><h3>🔹 Evolution of DuckDB</h3><p>Originally, DuckDB was built as a <strong>single-node OLAP database</strong> aimed at replacing SQLite for analytics. However, with increasing adoption in <strong>data science, AI, and embedded analytics</strong>, it evolved to:</p><ul><li>Support <strong>parallel query execution</strong> for better multi-core CPU utilization.</li><li>Integrate with <strong>data science tools like Pandas, Polars, and Apache Arrow</strong>.</li><li>Introduce <strong>Smallpond for distributed execution</strong>, leveraging <strong>Ray</strong> to break its single-node limitations.</li></ul><p>DuckDB’s evolution shows a <strong>shift from lightweight, local analytics</strong> to <strong>scaling analytical workloads across multiple nodes</strong> while keeping the database <strong>simple and efficient</strong>.DuckDB, the “single-node” analytics engine, is now stepping into distributed computing.<br>DeepSeek has recently partnered with DuckDB and successfully sorted <strong>110.5TB of data in just 30 minutes</strong>, achieving an average throughput of <strong>3.66 TiB/min</strong> using <strong>Smallpond</strong>. This marks a significant leap in distributed data processing and raises the question: <strong>Can Smallpond challenge PySpark as the go-to framework for large-scale distributed computing?</strong></p><p><strong>Key Differences in the architecture:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*DiGnxpn-zcVdk8Z8ALkZyQ.png" /></figure><h3>Performance Comparison</h3><h3>🔥 Benchmarks: How Do They Stack Up?</h3><p>DeepSeek benchmarked Smallpond sorting <strong>110.5 TiB of data in just 30 minutes</strong> (~3.66 TiB/min). While this is impressive, Spark has also achieved <strong>multi-petabyte sorting benchmarks</strong> in similar timeframes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*pBOsrTd8Y_HcJuwGnQNzaw.png" /></figure><p>🔹 <strong>Smallpond shines for partition-based workloads, while PySpark is better for complex transformations requiring shuffle operations.</strong></p><h3>Ease of Use &amp; Developer Experience</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*uc73E3D6QNjtZtuj3wgvNA.png" /></figure><p>✅ <strong>DuckDB + Smallpond is easier to start with, but managing Ray clusters adds overhead at scale.</strong></p><h3>Handling Skewed Data &amp; Out-of-Memory Issues</h3><h3>💡 Scenario: Dealing with Skewed Data Leading to OOM Errors</h3><p>Imagine a dataset with <strong>100 billion rows</strong>, where <strong>90% of the data belongs to just 2 categories</strong> while the rest is evenly distributed. A simple <strong>GROUP BY operation</strong> could cause Out-of-Memory (OOM) errors due to <strong>uneven workload distribution</strong>.</p><h3>How DuckDB + Smallpond Handles It:</h3><p>✅ <strong>Partitioning Strategies:</strong> Smallpond supports <strong>hash partitioning</strong>, meaning the data can be pre-distributed across nodes <strong>based on key values</strong> to avoid overloading a single node. ✅ <strong>Ray’s Task-Based Execution:</strong> Since <strong>each DuckDB instance</strong> in Smallpond only processes its assigned partition, <strong>skewed partitions still cause local OOM issues</strong>, but Ray can retry smaller partition sizes dynamically. ✅ <strong>Manual Partition Management:</strong> Users must manually <strong>ensure partition balance</strong>; otherwise, skewed data may still overload some nodes.</p><h3>How PySpark Handles It:</h3><p>✅ <strong>Adaptive Query Execution (AQE):</strong> PySpark can <strong>dynamically split</strong> skewed partitions and <strong>rebalance data before execution</strong>. ✅ <strong>Salting Technique:</strong> Spark allows adding a <strong>randomized key (salting)</strong> to break up large skewed partitions before joins. ✅ <strong>Broadcast Joins:</strong> If one side of a join is small, <strong>Spark automatically broadcasts it</strong> to avoid large shuffle operations.</p><h3>Verdict:</h3><p>🔹 <strong>PySpark has better built-in handling for skewed data</strong> due to AQE and dynamic partition adjustments.<br>🔹 <strong>Smallpond requires more manual intervention</strong> but benefits from <strong>Ray’s distributed retries</strong>.<br>🔹 <strong>If skew is extreme</strong>, <strong>both</strong> frameworks may require <strong>custom partitioning or sampling strategies</strong> to prevent OOM issues.</p><h3>Best Use Cases: When to Choose What?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*IN48gSfNj3UmUPVA40FAtA.png" /></figure><p>🔹 <strong>Choose Smallpond if:</strong> You need a lightweight, scalable, <strong>partition-based distributed analytics engine</strong> without setting up a full Spark cluster.</p><p>🔹 <strong>Choose PySpark if:</strong> You need a <strong>mature, distributed framework for complex ETL, joins, and real-time streaming.</strong></p><h3>The Verdict: Smallpond vs. PySpark — Who Wins?</h3><p>✅ <strong>Smallpond (DuckDB) Strengths:</strong></p><ul><li><strong>Faster startup time</strong> and <strong>easier local execution</strong>.</li><li><strong>Great for AI data preprocessing and analytics.</strong></li><li><strong>Efficient for partition-based workloads.</strong></li></ul><p>❌ <strong>Smallpond Weaknesses:</strong></p><ul><li><strong>Limited storage support (currently optimized for 3FS, no S3 yet).</strong></li><li><strong>Partition-level execution may not optimize shuffle-heavy workloads well.</strong></li><li><strong>Ray cluster management adds complexity.</strong></li></ul><p>✅ <strong>PySpark Strengths:</strong></p><ul><li><strong>Battle-tested for large-scale ETL and AI workflows.</strong></li><li><strong>Better for shuffle-heavy workloads (complex joins, aggregations).</strong></li><li><strong>Managed Spark options like Databricks make cluster management easier.</strong></li></ul><p>❌ <strong>PySpark Weaknesses:</strong></p><ul><li><strong>More setup complexity for small workloads.</strong></li><li><strong>Can have higher latency for single-node analytical workloads.</strong></li></ul><h3>Final Thoughts: Is Smallpond a Spark Killer?</h3><p>🚀 <strong>Not yet, but it’s an exciting alternative.</strong></p><p>🔹 <strong>For AI workloads and partition-based processing, Smallpond offers a lightweight, efficient solution.</strong></p><p>🔹 <strong>For large-scale distributed ETL and real-time data processing, PySpark remains the more robust choice.</strong></p><p>💡 <strong>What’s next?</strong> If Smallpond improves shuffle handling and expands storage support (S3, Delta Lake), it could become a serious alternative for <strong>distributed analytics without the overhead of Spark</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc884b4010e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Glue Job Cost Optimization: Right-Sizing Matters]]></title>
            <link>https://medium.com/@amuni/aws-glue-job-cost-optimization-right-sizing-matters-78a13b53a477?source=rss-4b154a4ddf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/78a13b53a477</guid>
            <dc:creator><![CDATA[Abhishek Muni]]></dc:creator>
            <pubDate>Thu, 27 Feb 2025 17:36:43 GMT</pubDate>
            <atom:updated>2025-02-27T17:36:43.917Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/254/1*u9h_U2u7bMI75HvdsJDYeQ.png" /></figure><h3>Introduction</h3><p>AWS Glue is a powerful <strong>serverless ETL service</strong> that enables organizations to <strong>extract, transform, and load (ETL) data</strong> at scale. However, if not configured correctly, Glue jobs can lead to unnecessary costs. This guide provides <strong>best practices and strategies</strong> to optimize Glue job costs while maintaining efficiency.</p><h3>1. Understanding Spark Architecture in AWS Glue</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JBHyiqR8aqE3DODK3j3sXQ.gif" /><figcaption><a href="https://www.linkedin.com/pulse/aws-glue-serverless-spark-processing-shanoj-kumar-v-3p3me/">Image Reference</a></figcaption></figure><p>AWS Glue is built on <strong>Apache Spark</strong>, a distributed computing framework designed for <strong>parallel processing</strong>. Understanding Spark’s architecture in the context of <strong>worker nodes and vCPUs</strong> helps in optimizing cost and performance. Refer <a href="https://medium.com/@amitjoshi7/spark-architecture-a-deep-dive-2480ef45f0be">here</a> to deep dive into spark architecture</p><h3>Key Components of Spark in AWS Glue:</h3><ul><li><strong>Driver Node:</strong> Manages job execution, task coordination, and metadata tracking.</li><li><strong>Executor Nodes (Workers):</strong> Perform actual computations on partitions of data.</li><li><strong>Task Slots (vCPUs per Worker):</strong> Each executor has multiple vCPUs that determine how many tasks can run in parallel.</li></ul><h3>How Worker Nodes and vCPUs Work in Glue?</h3><ul><li><strong>More Worker Nodes:</strong> Increases parallelism for tasks such as reading many small files from S3.</li><li><strong>More vCPUs per Worker:</strong> Improves efficiency for memory-intensive operations like joins and aggregations.</li></ul><p>✅ <strong>Optimization Tip:</strong> Use <strong>more workers for parallel file processing</strong> and <strong>higher vCPUs per worker for complex transformations.</strong></p><h3>2. Overview of DPU Specifications and Worker Nodes</h3><p>AWS Glue <strong>Data Processing Units (DPUs)</strong> determine compute and memory resources for Glue jobs. The specifications of each worker type are as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*KpEL92un3oPek4K0Cb1Y3g.png" /></figure><p>Visually DPUs and worker nodes can be represented as follows-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*DnfIiyRwGq5vmHJ_1VjjoQ.png" /><figcaption><strong>1 G.1X Worker Node</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*56dAO6BxcOYj0v_JkjlUCA.png" /><figcaption><strong>1 G.2X Worker Node</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*FE2WNPEcOraWLm402gpVSA.png" /><figcaption><strong>2 G.2X Worker Nodes</strong></figcaption></figure><h3>How to Specify the Number of Worker Nodes</h3><p>In AWS Glue, the number of worker nodes determines the level of parallelism for your job execution. You can specify the number of worker nodes in the job configuration:</p><h4>Using the AWS Console</h4><ol><li>Navigate to <strong>AWS Glue</strong> &gt; <strong>Jobs</strong>.</li><li>Select your job and go to the <strong>Job Details</strong> page.</li><li>Under the <strong>Job parameters</strong>, set the <strong>Number of workers</strong>.</li></ol><p><strong>Using AWS CLI</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*8DSPxDYve9LK_4neQbFS9w.png" /></figure><h4>Using PySpark in AWS Glue</h4><p>You can dynamically adjust worker nodes using <strong>job parameters</strong> in a PySpark script:</p><h4>Using PySpark in AWS Glue</h4><p>You can dynamically adjust worker nodes using <strong>job parameters</strong> in a PySpark script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*ioaA7l2wHFOlvx9DodpC3Q.png" /></figure><h3>More vCPUs vs. More Worker Nodes: When to Use Each?</h3><p>Choosing between <strong>more vCPUs per worker</strong> or <strong>more worker nodes</strong> depends on your workload:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*XGDKvcGUp9F-6rWA95iElQ.png" /></figure><p>✅ <strong>Use More vCPUs per Worker</strong> when your job involves <strong>heavy computations, memory-intensive processing, and large datasets that require in-memory operations.</strong></p><p>✅ <strong>Use More Worker Nodes</strong> when dealing with <strong>highly parallelized workloads, many small files, and partitioned data that benefit from concurrent execution</strong></p><h3>Use Case: Choosing Between Increasing DPUs vs. Adding More Workers</h3><h4>Scenario:</h4><p>A retail company is processing <strong>5 TB of sales transaction data</strong> stored in <strong>Amazon S3 (Parquet format, partitioned by date)</strong>. The job needs to:</p><ul><li><strong>Join transaction data</strong> with a 500 GB customer dataset (stored in DynamoDB)</li><li>Perform <strong>aggregations on sales data</strong> by region and product category</li><li>Output the processed data back to <strong>Amazon S3 in optimized Parquet format</strong></li></ul><h4>Data Distribution:</h4><ul><li><strong>5 TB transaction data</strong> (partitioned by date) → highly parallelizable</li><li><strong>500 GB customer data</strong> (single table in DynamoDB) → relatively small, but needs efficient join handling</li></ul><h4>Operations Involved:</h4><ul><li><strong>JOIN transaction data (S3) with customer data (DynamoDB)</strong></li><li><strong>AGGREGATE transaction data by region and category</strong></li><li><strong>WRITE the transformed data back to S3</strong></li></ul><p><strong>Deciding between increasing DPU vs Worker Nodes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*i6_hGcpk5S2YsjPmRyh_GA.png" /></figure><h4>Best Approach:</h4><ol><li><strong>Use a mix of both strategies</strong>:</li></ol><ul><li><strong>Increase DPUs to G.4X (16 vCPUs per worker)</strong> for efficient joins &amp; aggregation.</li><li><strong>Use 10–20 workers</strong> to parallelize reading &amp; writing tasks.</li></ul><p><strong>2.Broadcast</strong> the <strong>smaller dataset</strong> (customer data) to avoid shuffling</p><p><strong>3.Enable Glue Auto Scaling</strong> to optimize resource allocation dynamically.</p><h3>Example: When to Use Fewer DPUs vs. More DPUs for the Same Data Size</h3><h4>Scenario:</h4><p>A company processes <strong>500 GB of customer transactions</strong> stored in <strong>Amazon S3 (Parquet format, partitioned by month)</strong>. The job needs to:</p><ol><li><strong>Filter and extract</strong> the last 6 months of data.</li><li><strong>Perform simple aggregations</strong> (e.g., sum of sales per customer).</li></ol><h3>Example: When to Use Fewer DPUs vs. More DPUs for the Same Data Size</h3><h4>Scenario:</h4><p>A company processes <strong>500 GB of customer transactions</strong> stored in <strong>Amazon S3 (Parquet format, partitioned by month)</strong>. The job needs to:</p><ol><li><strong>Filter and extract</strong> the last 6 months of data.</li><li><strong>Perform simple aggregations</strong> (e.g., sum of sales per customer).</li><li><strong>Write the results back to Amazon S3.</strong></li></ol><h4>Operation 1: Requires Fewer DPUs</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*QOwMoCAUlFKC3WHNDEgYRQ.png" /></figure><h4>Operation 2: Requires More DPUs</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*gTn5lHQKHVFwtufSeOAkiA.png" /></figure><h3>Conclusion</h3><p>AWS Glue is a powerful tool, but <strong>costs can add up if not optimized</strong>. By choosing the <strong>right worker type, enabling auto-scaling, optimizing data formats, and reducing job execution time</strong>, you can significantly cut costs without sacrificing performance. Implement these strategies and make the most of your Glue workloads efficiently!</p><p>🚀 <strong>Start optimizing your Glue jobs today and save on AWS costs!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78a13b53a477" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Messaging: “Simply the Best, Better Than All the Rest” — A Guide to SNS, SQS, and SES]]></title>
            <link>https://medium.com/@amuni/aws-messaging-simply-the-best-better-than-all-the-rest-a-guide-to-sns-sqs-and-ses-fffa4457bfb5?source=rss-4b154a4ddf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/fffa4457bfb5</guid>
            <dc:creator><![CDATA[Abhishek Muni]]></dc:creator>
            <pubDate>Wed, 26 Feb 2025 21:34:12 GMT</pubDate>
            <atom:updated>2025-02-26T21:34:12.313Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS Messaging: “Simply the Best, Better Than All the Rest” — A Guide to SNS, SQS, and SES</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/277/1*EKwxPx8ChnirpvUNY9mazQ.png" /></figure><h3>Introduction</h3><p>AWS offers multiple messaging and notification services to help applications communicate asynchronously. The three core services for this are <strong>Amazon SNS (Simple Notification Service), Amazon SQS (Simple Queue Service), and Amazon SES (Simple Email Service)</strong>. Each serves a distinct purpose but can also be combined for more complex messaging workflows.</p><p>In this article, we will explore <strong>what SNS, SQS, and SES are</strong>, their <strong>individual use cases</strong>, and scenarios where they can be used <strong>together</strong>.</p><h3>1. Amazon SNS (Simple Notification Service)</h3><h3>What is SNS?</h3><p>Amazon SNS is a <strong>publish-subscribe (pub/sub) messaging service</strong> that enables applications to send messages to multiple subscribers instantly. It is designed for <strong>real-time, push-based notifications</strong>.</p><h3>How SNS Works</h3><ul><li>A <strong>Publisher</strong> (or Producer) sends a message to an <strong>SNS topic</strong>.</li><li><strong>Subscribers</strong> (like SQS queues, Lambda functions, email, or mobile devices) receive the message.</li><li>SNS delivers the message to <strong>all subscribers</strong> simultaneously.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*2al74VkjhhhetAmpFi1r4w.png" /><figcaption>Example of using SNS upon DAG failure</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*I_1BIrQpVzIRwLN4rquQrg.png" /><figcaption>Reference <a href="https://community.aws/content/2dZeMFOYlghxDkKofCNFXY4ZDKi/sqs-vs-sns-vs-ses">https://community.aws/content/2dZeMFOYlghxDkKofCNFXY4ZDKi/sqs-vs-sns-vs-ses</a></figcaption></figure><h3>When to Use SNS?</h3><p>✅ <strong>Real-time Notifications</strong>: Alerts for security breaches, stock price updates, or IoT sensor data.</p><p>✅ <strong>Fan-out Scenarios</strong>: Distribute the same message to multiple services (e.g., send notifications to mobile devices, SQS queues, and email simultaneously).</p><p>✅ <strong>Event-driven Architecture</strong>: Notify multiple microservices when an event occurs.</p><h3>SNS Limitations</h3><p>❌ <strong>No message persistence</strong>: If no subscriber is available, the message is lost.</p><p>❌ <strong>No ordering guarantee</strong>: Messages may not be delivered in the same order as they were published.</p><h3>2. Amazon SQS (Simple Queue Service)</h3><h3>What is SQS?</h3><p>Amazon SQS is a <strong>fully managed message queuing service</strong> that enables applications to send, store, and process messages asynchronously.</p><h3>How SQS Works</h3><ul><li>A <strong>Producer</strong> sends messages to an <strong>SQS queue</strong>.</li><li>Messages are stored in the queue until a <strong>Consumer</strong> retrieves and processes them.</li><li>Once processed, messages are deleted from the queue.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*tQ2LYtUcYyjc4W2RRnXYsA.png" /><figcaption>Reference <a href="https://community.aws/content/2dZeMFOYlghxDkKofCNFXY4ZDKi/sqs-vs-sns-vs-ses">https://community.aws/content/2dZeMFOYlghxDkKofCNFXY4ZDKi/sqs-vs-sns-vs-ses</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*9yCrqMrMjJs7Ptmkz2iBNg.png" /><figcaption>Example of sending SQS upon DAG failure</figcaption></figure><h3>Types of SQS Queues</h3><ul><li><strong>Standard Queue</strong>: Offers unlimited throughput but messages can be delivered out of order (best-effort ordering).</li><li><strong>FIFO Queue (First-In-First-Out)</strong>: Ensures that messages are processed in the exact order they are sent.</li></ul><h3>When to Use SQS?</h3><p>✅ <strong>Decoupling Services</strong>: Ensures reliability by allowing one service to send messages that another service can process later.</p><p>✅ <strong>Load Balancing</strong>: Distributes work evenly among multiple consumers.</p><p>✅ <strong>Retries &amp; Failure Handling</strong>: If a message processing fails, it remains in the queue for reprocessing.</p><h3>SQS Limitations</h3><p>❌ <strong>Not Real-Time</strong>: Messages are stored and processed when a consumer requests them.</p><p>❌ <strong>Polling Overhead</strong>: Consumers need to poll the queue to receive messages.</p><h3>3. Amazon SES (Simple Email Service)What is SES?</h3><p>Amazon SES is a cloud-based <strong>email sending service</strong> that allows applications to send <strong>transactional, marketing, and bulk emails</strong>.</p><h3>How SES Works</h3><ul><li>An application or user sends an email request to <strong>SES</strong>.</li><li>SES processes and sends the email via <strong>SMTP, API, or SDK</strong>.</li><li>SES provides features like <strong>DKIM, SPF, and feedback loops</strong> for email deliverability.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*IJBrvgtp9Qg1oCINfXWYgQ.png" /><figcaption>Reference:<a href="https://community.aws/content/2dZeMFOYlghxDkKofCNFXY4ZDKi/sqs-vs-sns-vs-ses">https://community.aws/content/2dZeMFOYlghxDkKofCNFXY4ZDKi/sqs-vs-sns-vs-ses</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*hFapZ1PmEDwuLN69BKbY_w.png" /><figcaption>Example of sending SES upon DAG failure</figcaption></figure><h3>When to Use SES?</h3><p>✅ <strong>Transactional Emails</strong>: Sending password resets, order confirmations, and account verification emails.</p><p>✅ <strong>Marketing Campaigns</strong>: Sending promotional and bulk emails to customers.</p><p>✅ <strong>Automated Email Notifications</strong>: Alerts, billing statements, and newsletters.</p><h3>SES Limitations</h3><p>❌ <strong>Not a messaging service</strong>: Unlike SNS and SQS, SES is solely for email communication.</p><p>❌ <strong>Requires Email Verification</strong>: To prevent spam, SES requires domain and email address verification.</p><h3>Conclusion</h3><p>AWS offers powerful messaging services — <strong>SNS for real-time notifications, SQS for message queuing and decoupling, and SES for email communication</strong>. Each service excels in its domain, but when combined, they create robust, scalable, and fault-tolerant architectures for event-driven applications.</p><p>✅ <strong>Use SNS</strong> when you need to fan out messages to multiple subscribers in real time.<br>✅ <strong>Use SQS</strong> when you need reliable, decoupled messaging with persistence and retries.<br>✅ <strong>Use SES</strong> when you need to send transactional or marketing emails at scale.</p><p>By leveraging these services together, you can build <strong>scalable microservices, efficient failure handling, and flexible notification systems</strong>. Whether you’re working with <strong>DAG failures, transaction processing, or serverless notifications</strong>, AWS messaging services provide a reliable foundation.</p><p>Now that you understand SNS, SQS, and SES, it’s time to integrate them into your applications and optimize your messaging workflows!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fffa4457bfb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An overVIEW: Understanding VIEWs in Relational Databases]]></title>
            <link>https://medium.com/@amuni/an-overview-understanding-views-in-relational-databases-454d669cac4e?source=rss-4b154a4ddf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/454d669cac4e</guid>
            <dc:creator><![CDATA[Abhishek Muni]]></dc:creator>
            <pubDate>Tue, 25 Feb 2025 11:27:53 GMT</pubDate>
            <atom:updated>2025-02-25T11:27:53.115Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*2_DnrOeohVQLBGlCSIclhA.png" /><figcaption>Reference: <a href="https://www.datacamp.com/tutorial/views-in-sql">https://www.datacamp.com/tutorial/views-in-sql</a></figcaption></figure><p>An appropriate one liner for views in the data world would be “<em>A </em><strong><em>view</em></strong><em> in a database is a virtual table that provides a way to present and manipulate data without storing it physically”.</em></p><h3><strong>Levels in a relational database system</strong>:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*OPxKvVHd2mO2Go6YDGoJEA.png" /><figcaption><a href="https://www.sprinkledata.com/blogs/dbms-architecture-its-5-key-components-and-types-of-database-models">DBMS Architecture</a></figcaption></figure><h4>1. Physical Level (Internal Level)</h4><ul><li>Represents the <strong>storage structure</strong> of data in the database.</li><li>Deals with physical storage, indexing, partitions, and file organization.</li><li>Users do not directly interact with this level.</li></ul><h4>2. Logical Level (Conceptual Level)</h4><ul><li>Defines the <strong>structure of the entire database</strong> and its relationships.</li><li>Includes tables,constraints, and indexes.</li><li>Independent of physical storage, providing a logical representation of data.</li></ul><h4>3.External Level (User Level)</h4><ul><li>Defines how <strong>individual users or applications</strong> see the data.</li><li>Provides different views of data based on user requirements.</li><li>Users access data through <strong>views</strong> to ensure security and usability.</li></ul><p><strong>Tables vs Views Comparison: </strong>Now that we are aware of where the views and tables fit into a relational database architecture let’s see some differences between them and their use cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XGFTbABxE4On51ZfoLWuFg.png" /></figure><h3><strong>Use Cases</strong></h3><p>An obvious question in mind why to take the pain of creating additional views when same things could be handled in tables in a logical partition. Here are some use cases.</p><h4>1.Central Query Logic</h4><ul><li>Views enable reusability by storing frequently used queries.</li><li>Developers and analysts can reference views instead of writing complex queries repeatedly.</li></ul><p><strong>Example</strong>: An <strong>e-commerce company</strong> wants to track total customer sales across various business reports. The Orders table stores transactional sales data, and different teams (finance, marketing, and customer insights) frequently request aggregated sales information.</p><p>Instead of executing the <strong>same complex aggregation query</strong> repeatedly across reports and dashboards, a <strong>view</strong> can be created to provide a reusable, optimized summary of customer sales.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*1OrgW0dwS3o6yn89IHxq2g.png" /></figure><p><strong>How this can be reused?</strong></p><p>1️⃣ <strong>Financial Reports:</strong></p><p>The finance team can directly use this view to generate <strong>monthly revenue reports</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*hjVbMJoZixIrEN-JImaUcg.png" /></figure><p>2️⃣ <strong>Marketing Segmentation:</strong></p><p>The marketing team can identify <strong>high-value customers</strong> for targeted campaigns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*W9Gw7HFRTmzI_G0SQE85Og.png" /></figure><p>3️⃣ <strong>Customer Support Insights:</strong></p><p>The support team can prioritize service for customers with a high order count.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*tcg_abHPU0PLwgX075yU6A.png" /></figure><p>4️⃣ <strong>Dashboard &amp; BI Tools:</strong>Business intelligence (BI) tools such as <strong>Tableau, Power BI, or Looker</strong> can connect directly to CustomerSalesSummary to generate <strong>live reports</strong>.</p><p>By using this <strong>view</strong>, all teams get <strong>consistent, up-to-date sales data</strong> without re-running complex queries, improving efficiency and database performance.</p><h4>2. Hiding Complexity</h4><ul><li>Views simplify complex joins, aggregations, and calculations.</li><li>Users can access data without understanding intricate query logic.</li></ul><p><strong>Example: </strong>A <strong>retail company</strong> wants to analyze the <strong>top-selling products by region</strong> based on multiple joins across <strong>Orders, Products, and Regions</strong> tables. Instead of writing a <strong>complex SQL query every time</strong>, a <strong>view</strong> simplifies the logic.</p><p><strong>Creating the View:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*3qugCJzUxcODTMY_8oKnhw.png" /></figure><p><strong>How This View Can Be Reused</strong>:</p><p>✅ <strong>Sales Reports:</strong> Generate <strong>regional sales rankings</strong> in a simple query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*6NP5Jh9DnA-H7pZhiTuFlA.png" /></figure><p>✅ <strong>Marketing Strategy:</strong> Identify the <strong>top-performing product per region</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dlXv5P_G6N0ieLiiddzCXA.png" /></figure><h3>3. Data Security</h3><ul><li>Views help enforce access control by exposing only necessary columns and rows.</li><li>Sensitive data can be hidden from unauthorized users.</li></ul><p><strong>Example:</strong>A <strong>hospital database</strong> stores patient records, but general <strong>staff should only see non-sensitive information</strong>. Instead of exposing the full Patients table, a <strong>view</strong> ensures that <strong>PII (Personally Identifiable Information)</strong> remains protected.</p><p><strong>Creating the Secure View:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uio2nDIlS8PtfWC3MyVAOQ.png" /></figure><p><strong>How This View Can Be Reused:</strong></p><p>✅ <strong>General Hospital Staff (Restricted Access):</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*JgGcX3QCeSRwYdNOpv3-wA.png" /></figure><p>✅ <strong>Full Access for Admins (Bypass the View)</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*vO4wO_yF2fRrBI8ROPNZ8A.png" /></figure><p><strong>✨ Benefit:</strong></p><ul><li>Non-sensitive data is <strong>accessible</strong> to all staff.</li><li><strong>Sensitive information (name, address, SSN, insurance details)</strong> is <strong>hidden</strong> from unauthorized users.</li><li>Security rules are <strong>enforced at the database level</strong>.</li></ul><h3>4. Flexibility and Dynamic Data</h3><ul><li>Views adapt dynamically to underlying data changes.</li><li>Useful for schema evolution where physical tables might change.</li></ul><h3>5. Virtual Data Marts</h3><ul><li>Views can act as <strong>virtual data marts</strong>, offering specialized datasets without duplicating data.</li><li>Reduces storage overhead while providing a structured way to analyze specific data sets.</li></ul><h3>Conclusion</h3><p>Views are an essential feature in databases, providing a flexible, secure, and efficient way to manage data access. By understanding the different levels of database architecture and the advantages of views over tables, businesses can improve data security, streamline query management, and optimize analytics workflows. Using views effectively ensures better data abstraction, consistency, and performance in database applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=454d669cac4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Power is Power]]></title>
            <link>https://medium.com/@amuni/power-is-power-fa589040f85e?source=rss-4b154a4ddf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa589040f85e</guid>
            <dc:creator><![CDATA[Abhishek Muni]]></dc:creator>
            <pubDate>Mon, 24 Feb 2025 06:58:04 GMT</pubDate>
            <atom:updated>2025-02-24T06:58:04.533Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dBtVGdxVwohQg2SxjeRhcA.png" /></figure><p>In the digital age, power is quite literally power — the electricity that fuels our computations, data centers, and everyday devices.</p><p>While developers often focus on speed and efficiency, there’s an overlooked cost of computation: power consumption. Every additional CPU cycle drains battery life, heats up servers, and increases energy costs. But how does algorithm selection affect power usage?</p><p>In this experiment, we explore how sorting algorithms — specifically Bubble Sort (O(n²)), Merge Sort (O(n log n)), and Quick Sort (O(n log n)) — impact energy consumption. Using macOS powermetrics, we measure CPU power usage for different input sizes and uncover why inefficient algorithms waste not just time, but also energy.</p><h3>Why Does Algorithm Efficiency Matter for Power Usage?</h3><p>We often analyze algorithms based on Big O notation, which describes how execution time and memory grows as input size increases. However, we rarely ask:</p><ul><li>Do inefficient algorithms consume more power?</li><li>Does faster execution always mean lower energy usage?</li><li>Can choosing the right algorithm reduce power costs in cloud computing?</li></ul><p>To answer these, we experimentally measure energy consumption for different sorting algorithms and visualize how power usage scales with input size.</p><h3>Experiment Setup</h3><h3>1️⃣ Measuring Power Consumption</h3><p>We use powermetrics, a macOS tool that reports CPU power usage in milliwatts (mW). The experiment follows this process:</p><ol><li>Measure CPU power before sorting.</li><li>Execute the sorting algorithm.</li><li>Measure CPU power after sorting.</li><li>Compute energy consumption (Joules) as: Energy (J)=Average Power (W)×Execution Time (s)\text{Energy (J)} = \text{Average Power (W)} \times \text{Execution Time (s)}Energy (J)=Average Power (W)×Execution Time (s)</li></ol><h3>2️⃣ Sorting Algorithms Tested</h3><p>We analyze three sorting algorithms with different complexities:</p><ul><li>Bubble Sort (O(n²)) → Simple but inefficient.</li><li>Merge Sort (O(n log n)) → Efficient divide-and-conquer approach.</li><li>Quick Sort (O(n log n)) → One of the fastest sorting techniques.</li></ul><h3>3️⃣ Input Sizes Tested</h3><p>Sorting algorithms are tested on randomly generated arrays of sizes:</p><p>[100, 500, 1000, 2000, 4000]</p><h3>4️⃣ Environment</h3><ul><li>Machine: MacBook Pro (Apple Silicon)</li><li>OS: macOS (measuring power with powermetrics)</li><li>Programming Language: Python 3</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R1yD_lNmBgDaTmqn" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J4H4VTKq3hkvQ8bh" /></figure><h3>Results &amp; Analysis</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6NkmIiQXDDK1SVfv" /></figure><h3>Graph Interpretation</h3><ul><li>Bubble Sort (O(n²)) → Energy consumption increases quadratically.</li><li>Merge Sort &amp; Quick Sort (O(n log n)) → More power-efficient scaling.</li></ul><h3>Key Insights</h3><ul><li>Bubble Sort wastes power due to unnecessary comparisons.</li><li>Merge Sort and Quick Sort process data efficiently, reducing CPU cycles.</li><li>Choosing an efficient algorithm can significantly reduce power costs.</li></ul><h3>Conclusion</h3><p>This experiment proves that algorithm efficiency isn’t just about speed — it also impacts power consumption.</p><ul><li>Bubble Sort is power-hungry and should be avoided.</li><li>Merge Sort and Quick Sort are far more energy-efficient.</li><li>Optimizing algorithms helps extend battery life and reduce data center power costs.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa589040f85e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[P(a.i)nting is the new art: DALL-E 2, the da Vinci in the renAIssance of creativity??]]></title>
            <link>https://medium.com/@amuni/p-a-i-nting-is-the-new-art-dall-e-2-the-da-vinci-in-the-renaissance-of-creativity-7d6c496dc0f5?source=rss-4b154a4ddf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d6c496dc0f5</guid>
            <dc:creator><![CDATA[Abhishek Muni]]></dc:creator>
            <pubDate>Tue, 25 Oct 2022 00:01:41 GMT</pubDate>
            <atom:updated>2022-10-25T00:14:05.872Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hX8SVwYHJ9E7gZsdtQ1OWA.png" /><figcaption>Picture generated at <a href="https://openai.com/dall-e-2/">https://openai.com/dall-e-2/</a></figcaption></figure><p>Recently there has been a blast of AI generated arts in the internet followed by some breakthroughs for which machines can now generate paintings with aesthetic taste contextual to the text prompts typed as input. The results are so visually appealing that it has triggered controversies and debates of arrival of doomsday for the artists. This article would not judge the outcomes of the technology, rather it would delve into the uniqueness of one of the most popular models<a href="https://openai.com/dall-e-2/"><em>(</em><strong><em>openAI’S DALL.E2</em></strong></a>) that brought the revolution in AI art.</p><h4>DALL-E2 architecture:</h4><p>The technology used in DALL-E2 is not new, but is a modification of it’s predecessor DALL-E to produce visually more appealing and realistic images. This is how the architecture for DALL-E2 looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rJC4p7YGbiQfX7G0hGRDNA.jpeg" /><figcaption>Image Source: <a href="https://bdtechtalks.com/2022/04/11/openai-dall-e-2/">https://bdtechtalks.com/2022/04/11/openai-dall-e-2/</a></figcaption></figure><p>This particular diagram of a “Corgi playing flame throwing trumpet” is quite popular in the internet due to it’s illustration in the <a href="https://cdn.openai.com/papers/dall-e-2.pdf">original paper</a> 😀As we can see in the diagram the DALL-E 2 consists of 3 main components I would discuss briefly on each of them:</p><ol><li><strong>CLIP(Contrastive Language-Image Pre-training): </strong>The CLIP model was originally designed to generate appropriate caption for a given image, basically the opposite of what DALL-E tries to achieve. But it is used as a component in DALL-E 2 to understand the link between textual semantics and their visual representation. The word “embedding” refers to the representation of the information in a mathematically understandable vector space. For example, the captions that are entered as input to the models are merely ASCII characters and are far from anything that the models can interpret. One common way of digitizing the information is putting all possible words in an array-like bag of words and o<a href="https://hackernoon.com/what-is-one-hot-encoding-why-and-when-do-you-have-to-use-it-e3c6186d008f">ne-hot-encoding</a> those words to represent them in matrics space. But this approach would hit a couple of challenges during implementation:<br>a) The CLIP DALL-E 2 uses 3.5 billion image and text caption pairs to train and one-hot-encoding would yield a computationally challenging sparse matrix of this dimension with only 1 “1” value in each row and rest 0s.<br>b)The distance between the vectors in this kind of representation would be as per the sequence of their occurence alphabetically and this would not give the actual contextual representation. For example the words “car” is more closely related to words like “vehicle” , “truck” , “sedan”, “suv” than the word “cat”.<br>In-order to overcome these challenges each word is represented as a combination of a feature matrix, where each feature represent a category to generically classify the object like “living/non-living”, “plant/animal”“gender”, “geography”, “texture”, “color” etc. By doing this the dimension is reduced drastically as the number of features is far lesser than the number of parameters trained and there would be more 1s now than 0s. Also the vectors are aligned appropriately so that they are relatively closer to each other after dimensional reductions.Similarly image-embeddings are representation of the pixel values of the images in the vector space.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4e-6STiM-JFDDseg9ZcQRw.gif" /><figcaption>Visual illustration of CLIP training in DALLE2</figcaption></figure><p>As shown in the illustration,during the CLIP training the N image and text pairs are passed through the encoders to generate embeddings N embeddings of each. A total of (N x N) cosine similarity of each image and text pairs are generated. Then the model weights are adjusted in order to maximize the cosine similarity along the N diagonal elements(correct image-text caption pairs) and minimize the cosine similarity for the rest of the elements. After the CLIP training is completed the model is frozen to proceed to the next phase of training. The CLIP model is critical in DALL-E 2 as it establishes the semantic relation between the input captions with the appropriate image. Although it does not generates the final image, the images and the text embeddings are used for the base for creating the final images in the generative models. For example, in the diagram above illustrating the DALL-E 2 architecture, the CLIP model does not generate an aesthetically looking great image of a “Corgi playing a flame throwing trumpet”. But instead it helps the system understand how an animal playing a flame throwing trumpet might look like and creates an uncanny representation of the same in the vector space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Cnx7j7H1XAv4DSAOWyijg.png" /><figcaption>CLIP example from the <a href="https://arxiv.org/abs/2106.14843">paper</a></figcaption></figure><p>Let X be the final image and Zi and Zt be the image and text embeddings and Y be the input caption.As Zi and Zt are deterministic functions of X and Y respectively it could be said <br><strong><em>P(X|Y) = P(X,Zi|Y) = P(X,Zi|Zt) =P(Zi|Zt) * P(X|Zi,Zt)</em></strong><em> </em>(Using Markov’s chain rule)which brings us to the next two components of the model.</p><p><strong>2. Prior: </strong>The first part of the formulae <strong><em>P(Zi|Zt) </em></strong>brings us to the prior models. The prior models is trained to generate image embeddings from the CLIP text embeddings. The DALL-E 2 uses a diffusion model to achieve that as opposed to the auto-encoder used by it’s predecessor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*5TncBjZXfCK5R5CnSV-s8w.gif" /></figure><p>Diffusion model is the meat of DALL-E 2 and is inspired by the thermodynamic laws of non-equilibrium. Let’s consider the example of ink diffusing into water. Throughout the process the system is in non-equilibrium and goes into more randomness. Each of those instant in the process is represents a particular state that is dependent on just the state previous to that and not on the path the system took to achieve that state.The state where the link diffused is complete randomness.In physical world this process is irreversible, but in diffusion model something similar is attempted to be achieved mathematically.The state where the ink started to be diffused could be compared to the clean image. Some amount of Gaussian noise is applied to the image iteratively until the image is completely unidentifiable. This state could be compared to the state where the ink is completely diffused.The model is then trained to return to the original image by iteratively substracting little amount of noise to return to the just previous state.This process is referred as the reverse diffusion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*iAB4aS1yGoBQGlrovBw0AQ.jpeg" /><figcaption>Markov chain for reverse diffusion</figcaption></figure><p><strong>3. The Decoder: </strong>The takes the image embeddings as input to generate the final images. The consists of a modified <a href="https://arxiv.org/abs/2112.10741">GLIDE</a> (<strong>G</strong>uided <strong>L</strong>anguage to <strong>I</strong>mage <strong>D</strong>iffusion for Generation and <strong>E</strong>diting)diffusion model. GLIDE is another diffusion model, but it is given text embeddings as an additional input to support the process of image generation.Initially DALL-E 2 was primarily GLIDE and we could know a lot about GLIDE from the paper <a href="https://arxiv.org/pdf/2112.10741.pdf">https://arxiv.org/pdf/2112.10741.pdf</a>.In DALL-E 2 second version(unCLIP/DALL-E 2 ),GLIDE is modified to take the CLIP embeddings in 4 extra tokens in addition to the text captions. For training purposes the CLIP embeddings were randomly dropped for 10 % of the time and text for 50% of the time. Two up-samplers were used to increase the resolution from 64 X64 to 1024 X 1024.For the first upsampling stage, gaussian blur was used, and for the second, a more diverse <a href="https://arxiv.org/abs/2103.14006">BSR degradation</a> is used, which includes JPEG compression artifacts, camera sensor noise, bilinear and bicubic interpolations, Gaussian noise. The models are trained on random crops of images that are one-fourth the target size. Text conditioning is not used for the upsampling models.</p><h3>Why to use prior at all?? 😕</h3><p>Now that we have a brief idea about the various components of DALL-E 2, it’s quite common question in mind about why even we bother training and using prior when both the image and text CLIP embeddings be taken as input by the decoder to generate images?? Infact, this is what the original GLIDE model or the initial version of DALL-E 2 did. The authors of the <a href="https://cdn.openai.com/papers/dall-e-2.pdf">unCLIP DALL-E2</a> even tried experimenting with various combinations with and without the prior model : 1)<strong> Text caption and zero CLIP embedding, 2) Text caption and CLIP text embedding as if it were an image embedding, 3) Text and CLIP image embedding generated by the prior</strong>. Conditioning the decoder on just the caption is clearly worst, but conditioning on text embeddings zero-shot does produce decent results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wR_Sf5AF2Y9fPF1BfnIcTw.png" /></figure><p>Also, as per the authors of the paper the model was trained to do text-to-image generation task for 5 percentage of the time. So comparing the results with this difference in training would not do the justice.</p><h3>Aesthetic Quality Comparison:</h3><p>DALL-E2 additionally performed automated aesthetic quality evaluations comparing unCLIP to GLIDE. The goal was to assess how well each model produces artistic illustrations and photographs. 512 “artistic” captions using <a href="https://arxiv.org/abs/2005.14165">GPT-3</a> [4] were generated by prompting it with captions for existing artwork (both real and AI generated). CLIP linear probe was trained to predict human aesthetic judgments using the <a href="https://arxiv.org/abs/1705.08421">AVA dataset</a> . For each model and set of sampling hyperparameters, four images were produced for each prompt, and the mean predicted aesthetic judgment over the full batch of 2048 images was reported. This is the reason why DALL-E 2 produces aesthetically astounding results in compared to it’s predecessor models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*nS7_cLl1jeNyo-gh8yRR6Q.jpeg" /><figcaption>DALL-E 2 generated images listed in the<a href="https://openai.com/dall-e-2/"> website</a></figcaption></figure><h3>Limitations:</h3><p>Despite of such success in generating artist like aesthetic images DALL-E 2 has some serious flaws and some of them have been listed in the <a href="https://cdn.openai.com/papers/dall-e-2.pdf">paper</a> itself. DALL-E 2 miserabellyfails in generating coherent texts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*veViOTbxUwEzi-FW___FjQ.png" /><figcaption>Image generated for caption “Under Construction”</figcaption></figure><p>This flaw is attributed to a great extend to the BPE encoders obscuring the spelling of the words. Apart from this the model sometimes mixes up object attributes while generating images and produces dissatisfying results for complex scenes.</p><p>In terms of innovation, openAI did not bring anything new to the stack for creating DALL-E 2. Rather they found a way to fit the best features of some of it’s predecessors to obtain phenomenal outputs with some serious flaws. Nevertheless,it has opened doors for a different dimension of creativity. Also it’s recent partnership with Microsoft would ameliorate it’s presence in commercial world from just being a non-profit open-source platform. In terms of being an <a href="https://en.wikipedia.org/wiki/Artificial_general_intelligence">AGI</a> system,DALL-E 2 has a long way to go,but the <em>ren</em><strong><em>AI</em></strong><em>ssance</em> has already arrived.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d6c496dc0f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[THE A.IQuotient]]></title>
            <link>https://medium.com/@amuni/the-a-iquotient-46c39a9e4d14?source=rss-4b154a4ddf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/46c39a9e4d14</guid>
            <dc:creator><![CDATA[Abhishek Muni]]></dc:creator>
            <pubDate>Sun, 18 Sep 2022 18:35:57 GMT</pubDate>
            <atom:updated>2022-09-18T18:35:57.395Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>THE</strong> <strong>A.I<em>Q</em></strong><em>uotient</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*jhv_5unF0682lod8yW8UaA.jpeg" /></figure><p>July 2022 marked a big leap in not only the AI community, but in the entire research world when deep mind released alpha fold2’s prediction for almost all catalogued proteins known to science. Artificial intelligence has been ubiquitous for the past one decade and has potential to catalyze every progress of the mankind. Curiosity has always been there to gauge the efficacy of the “AI<em>ntelligence” </em>with respect to that of human counterpart. But even with all the advancements did we even reach to a point where we could map important functionalities of human brain with that of the machine?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*A7xFF69w-W-grf8xeZ5qsA.jpeg" /></figure><p>We definitely have satisfactory number of performance matrices to determine the state-of-the-art models in the respective areas. But the units used to measure point to the most prominent rift between our achievements and expectations. Almost every model known to the community today comes under the narrow AI category. <a href="https://medium.com/mapping-out-2050/distinguishing-between-narrow-ai-general-ai-and-super-ai-a4bc44172e22"><em>This</em></a><em> </em>is one useful link to understand narrow AI and the other categories of the same classification. Unlike the human brain almost every model used today are good at performing very specific tasks. Even the deep learning models that tries to mimic some of the basic operating principles of human neural system need exclusive training and dedicated computing resources to achieve satisfactory levels of accuracy in doing the task. The <a href="https://alphafold.ebi.ac.uk/"><em>alpha-fold</em></a> cannot predict anything that is not protein,<a href="https://www.deepmind.com/research/highlighted-research/alphago"><em>alpha-go</em></a> can not play a chess game and the list goes on. Even the self driving vehicles have some trained rnns running in the backend for which they fail miserably in performing basic task of object detection if the weather or the terrain conditions vary from what they were trained. On the other hand the human intelligence is far more cognitive,sentient and sensitive to emotions. One possible cause of the difference could be because of the far more complicated process of evolution that we went through in comparison to the meer decades of data that’s fed into the system. For example when a reference is made of an animal enumerable processes associated with that animal is triggered parallely in our sub-conscious brain which might include the origin of the animal, it’s eco-system, life-span ,food habits and so on instead of just associating with specific features like eyes, nose and the contour map of that animal. The human intelligence is far more normalized and generic and that’s the reason why even a basic human task of distinguishing between a running and standing animal becomes challenging for the machine. Our brain somehow maps the task associated to the other forms of life without even receiving that event as an input. This difference has led to a new focus for the research known as <a href="https://en.wikipedia.org/wiki/Artificial_general_intelligence"><em>AGI</em></a><em>. </em>There has been some interesting progress made by deepmind’ <a href="https://www.deepmind.com/publications/a-generalist-agent"><em>GATO</em></a> and openAI’s <a href="https://openai.com/dall-e-2/"><em>DALL.E</em></a>, but these are still in their nascent phase.</p><p>Considering the recent breakthroughs of AI, it has definitely helped achieving beyond mankind’s imagination.On the flip side there is also a significant lag from the imagination of mankind about a much more sentient and emotionally intelligent form of AI where in movies single machine outperforms human in every aspect or where people develop romantic relations with machines. As the research would progress to address the gap we would definitely have more human-like machines in future and a system to gauge “<em>How intelligent is AI?</em>”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46c39a9e4d14" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>