<?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 Anurag Srivastava on Medium]]></title>
        <description><![CDATA[Stories by Anurag Srivastava on Medium]]></description>
        <link>https://medium.com/@anurag.srivastava2408?source=rss-3eeb53e0fe96------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*eqPfJ4J3mTvhZBgk</url>
            <title>Stories by Anurag Srivastava on Medium</title>
            <link>https://medium.com/@anurag.srivastava2408?source=rss-3eeb53e0fe96------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 05:04:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anurag.srivastava2408/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[Stopping the GPU Meter: How Decoupling Our ML Pipeline Cut Runtime by ~50% and Costs by ~25%]]></title>
            <link>https://ai.plainenglish.io/stopping-the-gpu-meter-how-decoupling-our-ml-pipeline-cut-runtime-by-50-and-costs-by-25-76a6f9675822?source=rss-3eeb53e0fe96------2</link>
            <guid isPermaLink="false">https://medium.com/p/76a6f9675822</guid>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[gpu-computing]]></category>
            <category><![CDATA[apache-spark]]></category>
            <dc:creator><![CDATA[Anurag Srivastava]]></dc:creator>
            <pubDate>Sun, 29 Nov 2026 17:39:55 GMT</pubDate>
            <atom:updated>2026-11-29T17:39:55.616Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How we broke a slow, expensive geospatial inference job into CPU- and GPU-bound stages — guided by profiling the old pipeline — and stopped paying GPU prices for waiting around.</em></p><p>Imagine renting a Ferrari just to sit in bumper-to-bumper traffic.</p><p>That is basically what happens when you run an entire machine learning pipeline on GPU machines. Every second a GPU server spends on input prep for inference like downloading images, querying a database, and on post processing over the inference output files is a second where expensive hardware sits idle while your cloud bill keeps climbing.</p><p>In our mapping pipeline — which detects the add/delete/update road geometry from satellite imagery and probe heatmaps — we fixed this by profiling the monolithic job and decoupling it into CPU- and GPU-bound stages connected by an Azure Blob container. The entire pipeline runs on Apache Spark and is deployed on Kubernetes (K8s).</p><p>The payoff: <strong>~50% faster runs</strong> and <strong>~25% lower cloud compute costs</strong>.</p><h4>1. <strong>What Our Pipeline Actually Does</strong></h4><blockquote>To keep maps accurate across large regions, our Spark-on-K8s system runs through three steps:</blockquote><p><strong>1.1 Gather the data:</strong> Pull existing road data from a spatial database, download satellite image tiles over HTTP, and also pull the probe heat map.</p><p><strong>1.2 Run the model:</strong> Feed those image batches into an ONNX model to detect road geometry additions, deletions, and updates from satellite imagery and probe heat maps.</p><p><strong>1.3 Clean and save the results:</strong> Turn those raw model predictions into clean map vectors, check confidence scores, snap lines together, and prepare the transaction to ingest into the master database</p><h4><strong>2. Why One Big Pipeline Wastes Time and Money</strong></h4><blockquote>Keeping everything inside one Spark-on-K8s GPU job creates three headaches:</blockquote><h4>2.1 Paying GPU Prices for Waiting</h4><p>GPUs are some of the priciest machines in the cloud. When a Spark executor pauses to download dozens of image tiles or wait on database queries, the GPU just sits there. You end up paying premium GPU rates for basic network traffic.</p><h4>2.2 One Machine Size Doesn’t Fit All</h4><p>Profiling made the hardware split obvious:</p><ul><li><strong>Data prep and cleanup</strong> are CPU- and memory-bound — they need lots of regular CPU cores, memory, and fast networking.</li><li><strong>Model inference</strong> is GPU-bound — it needs heavy GPU power.</li></ul><p>When everything runs in one job, you are stuck with a bad trade-off: pay for big GPU nodes that sit half-idle, or use smaller nodes that choke during data downloads.</p><h4>2.3 Losing Hours of Work to Spot Interruptions</h4><p>Large runs often use cheap cloud spot (preemptible) nodes in Kubernetes, which the cloud provider can take back with little warning. In a single big Spark job, losing a pod or node halfway through can mean starting over — re-downloading the same images and re-running the same queries all over again.</p><h3>3. How We Rebuilt It</h3><blockquote>Guided by our profiling data on the monolithic pipeline, we scaled the entire workflow with Spark on Kubernetes around a simple idea: <strong>decouple CPU- and GPU-bound workloads, match each to the right K8s node pool, and save progress in an Azure Blob container between steps.</strong></blockquote><h4>3.1 Match the Hardware to the Work</h4><ul><li><strong>Stage 1 (CPU-Bound Data Prep):</strong> Runs as a Spark job on CPU node pools in Kubernetes, spinning up executors in parallel to download satellite and probe heat map tiles, fetch database records over API, and save compressed image batches to an Azure Blob container.</li><li><strong>Stage 2 (GPU-Bound Inference):</strong> Runs as a Spark job on dedicated GPU node pools in Kubernetes with <strong>zero database or external API connections</strong>. Executors simply grab ready-to-go batches from the Azure Blob container, run predictions at full speed, and write the results back.</li><li><strong>Stage 3 (CPU-Bound Cleanup):</strong> Runs as a Spark job on high-memory CPU node pools in Kubernetes to turn raw predictions into clean road vectors and load them into the database.</li></ul><h4>3.2 Shrink the Control Node</h4><p>In Spark on Kubernetes, the driver pod often defaults to the same heavy machine type as the executors. Decoupling the pipeline let us run the driver on a small, general-purpose node — cutting idle driver costs by <strong>over 50%</strong>.</p><h4>3.3 Make Failures Cheap</h4><p>Because the Azure Blob container acts like a save point between stages, a spot eviction during Stage 2 never erases the work done in Stage 1. The GPU Spark job simply picks up from the files already sitting in the blob container.</p><h3>Before vs. After</h3><p>When we profiled the old monolithic setup (a single Spark job running on GPU nodes in Kubernetes), one worker did everything in order. That meant the GPU sat around doing nothing (average utilisation was around 15–20%) during step 1.1 and step 1.3</p><p>Profiling showed clearly which steps were CPU- and network-bound versus GPU-bound. Instead of forcing one expensive machine to do all three jobs, we decoupled the pipeline into CPU- and GPU-bound Spark stages on Kubernetes, connected through an Azure Blob container</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VqSUmBnmEfQDI6u_rYovxQ.png" /></figure><h3>4. The Results</h3><blockquote>When we compared the new Spark-on-K8s pipeline against the old monolithic setup across regional runs, the difference was clear:</blockquote><ul><li><strong>Total Run Time:</strong> ~40% faster</li><li><strong>Total Compute Cost per Run:</strong> ~25% lower</li><li><strong>Worker Compute Unit Cost:</strong> ~40% lower</li><li><strong>Per-Unit Latency:</strong> ~20% faster</li><li><strong>GPU Usage:</strong> Much higher (no waiting on downloads or DBs)</li><li><strong>Crash / Preemption Recovery:</strong> Restart just one stage instead of the whole job</li></ul><h3>What Drove the Gains?</h3><ol><li><strong>GPUs stayed busy:</strong> Removing network and database calls meant GPUs spent their time running the model instead of waiting on data. GPU utilisation went up to ~45–50 %</li><li><strong>Cheaper scale for downloads:</strong> Using low-cost CPU node pools in Kubernetes for parallel downloads cost far less than keeping GPU nodes open.</li><li><strong>No repeated work:</strong> Saved checkpoints in Azure Blob meant upstream data prep didn’t have to re-run when a GPU node got preempted.</li></ol><h3>The Takeaway</h3><blockquote><strong>Don’t make an expensive GPU do basic chores.</strong></blockquote><p>If your GPU executors are making HTTP requests, parsing files, or waiting on database queries, you are burning money on idle hardware. Profiling your pipeline to decouple CPU- and GPU-bound Spark stages on Kubernetes — connected through an Azure Blob container — is a straightforward way to make batch ML pipelines faster, cheaper, and easier to recover when things fail.</p><p><em>What eats up the most time in your ML pipelines right now — getting the data ready, running the model, or cleaning up the output?</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76a6f9675822" width="1" height="1" alt=""><hr><p><a href="https://ai.plainenglish.io/stopping-the-gpu-meter-how-decoupling-our-ml-pipeline-cut-runtime-by-50-and-costs-by-25-76a6f9675822">Stopping the GPU Meter: How Decoupling Our ML Pipeline Cut Runtime by ~50% and Costs by ~25%</a> was originally published in <a href="https://ai.plainenglish.io/">Artificial Intelligence in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>