<?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 Swapnesh Khare on Medium]]></title>
        <description><![CDATA[Stories by Swapnesh Khare on Medium]]></description>
        <link>https://medium.com/@swapkh91?source=rss-405aa4037783------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*QWsHht10rm7XPnkv</url>
            <title>Stories by Swapnesh Khare on Medium</title>
            <link>https://medium.com/@swapkh91?source=rss-405aa4037783------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 05:32:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@swapkh91/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[⚡️ Real-Time, All the Time: How We Streamed Data from Everywhere into Dashboards and APIs in…]]></title>
            <link>https://medium.com/cars24-data-science-blog/%EF%B8%8F-real-time-all-the-time-how-we-streamed-data-from-everywhere-into-dashboards-and-apis-in-095711edf1b2?source=rss-405aa4037783------2</link>
            <guid isPermaLink="false">https://medium.com/p/095711edf1b2</guid>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[cars24]]></category>
            <category><![CDATA[data-platforms]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[starrocks]]></category>
            <dc:creator><![CDATA[Swapnesh Khare]]></dc:creator>
            <pubDate>Sat, 19 Apr 2025 06:13:18 GMT</pubDate>
            <atom:updated>2025-04-23T10:07:53.931Z</atom:updated>
            <content:encoded><![CDATA[<h3>⚡️ <strong>Real-Time, All the Time: How We Streamed Data from Everywhere into Dashboards and APIs in Seconds</strong></h3><blockquote>From hourly dashboards to sub-second APIs — how we built a blazing-fast, cost-efficient analytics pipeline using cloud-native tools and open-source tech.</blockquote><h3>🧩 Why We Built This</h3><p>The ops team and analysts at CARS24 used to rely on hourly data syncs into Snowflake, visualized in Tableau. Meanwhile, internal services and APIs needing fresh insights had to deal with stale or incomplete data — not ideal when seconds matter.</p><p>We needed <strong>real-time visibility</strong> and <strong>instant data access</strong> — for both human dashboards <em>and</em> real-time DS/ML APIs.</p><p>So, we built a real-time data ingestion and analytics pipeline on <strong>GKE</strong> using:</p><ul><li><strong>Google Pub/Sub</strong></li><li><a href="https://kafka.apache.org/"><strong>Apache Kafka</strong></a></li><li><a href="https://www.starrocks.io/"><strong>StarRocks</strong></a></li><li><a href="https://min.io/"><strong>MinIO</strong></a><strong> + Google Cloud Storage</strong></li><li><a href="https://superset.apache.org/"><strong>Apache Superset</strong></a></li></ul><p>Now, the same live data that fuels dashboards also powers low-latency APIs for DS/ML use-cases — unlocking new automation, intelligence, and responsiveness across systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K_ssPxz8POPAQ_k51H2VFw.png" /><figcaption>Data Ingestion/Delivery Architecture</figcaption></figure><h3>🔌 Step 1: Unified Ingestion with Google Pub/Sub</h3><p>We start by streaming data into <strong>Google</strong> <strong>Pub/Sub</strong>, which acts as our real-time message broker. This includes:</p><ul><li><strong>BigQuery exports/CDC</strong> pushed as events</li><li><strong>Internal APIs</strong> pushing app metrics and events</li><li><strong>Third-party vendor data feeds</strong></li></ul><p>This gave us a consistent entry point for all inbound data, regardless of origin. Pub/Sub acts as the unified, decoupled transport layer that feeds the rest of our pipeline.</p><h3>🔄 Step 2: From Pub/Sub to Kafka (Yes, Both!)</h3><p>Why both? Because:</p><ul><li><strong>Pub/Sub</strong> is great for ingesting external data.</li><li><strong>Kafka</strong> gives us better buffering, replayability, and tooling for downstream processing.</li></ul><p>We use the <a href="https://github.com/googleapis/java-pubsub-group-kafka-connector/"><strong>Pub/Sub Source Connector</strong></a> to stream messages directly into <strong>Kafka topics</strong>. This makes the system more flexible and robust — with Kafka acting as a durable message bus between ingestion and analytics.</p><h3>🚀 Step 3: Real-Time Ingestion into StarRocks</h3><p>Here’s where the magic happens.</p><p>We use <strong>StarRocks’ Routine Load</strong> feature to ingest Kafka topics continuously. No more batch jobs, no more delays — just real-time data landing in StarRocks tables, ready to be queried.</p><p>Why StarRocks?</p><ul><li>Blazing fast query performance</li><li>Native support for Kafka ingestion</li><li>Scales horizontally</li><li>Great for <strong>real-time analytics workloads</strong></li><li><strong>Materialized Views</strong> which further improve query performance</li></ul><p>We run <strong>StarRocks in shared-data mode</strong>, which separates compute from storage. This lets us autoscale <strong>Compute Nodes (CNs)</strong> based on real-time load using <strong>Kubernetes HPA</strong>.</p><h3>📦 Step 4: Smart Storage with MinIO &amp; GCS</h3><p>Storage costs can escalate quickly, especially with SSDs. So we introduced <a href="https://min.io/docs/minio/kubernetes/gke/administration/object-management/object-lifecycle-management.html#availability-of-remote-data"><strong>tiered storage</strong></a>:</p><ul><li><strong>Hot Data</strong> → Stored on <strong>MinIO</strong> (an S3-compatible object store inside our cluster)</li><li><strong>Cold Data</strong> → Offloaded to <strong>Google Cloud Storage (GCS)</strong> to save cost</li></ul><p>StarRocks integrates smoothly with this setup. Queries hit hot storage for recent data and fetch older data from cold storage only when needed — with minimal performance impact. There is a feature within StarRocks for data tiering which can move data from SSD to HDD. This is useful where you want to further reduce tiered data retrieval time, but comes at the cost of having HDDs.</p><p>💰 <strong>Result:</strong> Big storage savings, no compromise on query performance.</p><h3>📊 Step 5: Real-Time Dashboards with Superset</h3><p>Finally, we plugged <strong>Apache Superset</strong> into StarRocks.</p><p>Superset is fast, open-source, and user-friendly. It lets the team:</p><ul><li>Build and view dashboards in real time</li><li>Run complex queries with sub-second response times</li><li>No need to wait for the Snowflake sync or Tableau refresh</li><li>A fully open-source analytics stack (bye-bye, Tableau license fees!)</li></ul><h3>🆚 Before vs. After</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lj1EuAWN90gMazxNGmyJEg.png" /></figure><h3>💡 Key Takeaways</h3><ul><li><strong>Decoupling ingestion from processing</strong> via Pub/Sub and Kafka gave us flexibility and reliability.</li><li><strong>StarRocks</strong> provided the perfect balance of real-time performance and cost efficiency.</li><li><strong>Tiered storage</strong> with MinIO and GCS dramatically cut down our storage costs.</li><li><strong>Superset + StarRocks</strong> made real-time analytics truly self-service for the Ops team.</li></ul><p>This pipeline has completely transformed how we operate. Our Ops team no longer waits for stale dashboards — they act on live data. And it’s not just people who benefit:</p><p>Our <strong>real-time DS/ML APIs</strong> now fetch up-to-the-second data directly from <strong>StarRocks</strong>, powering internal tools, automations, and services that rely on fast, accurate insights. Whether it’s a live personalization service or a backend service making decisions based on operational metrics — they’re all plugged into the same real-time engine.</p><p>We’ve reduced costs, improved performance, and unlocked a new level of agility and intelligence across the organization.</p><h3>🔭 Future Work &amp; Limitations</h3><p>While our real-time pipeline has significantly improved visibility and responsiveness across teams, it’s still evolving — and there are a few areas we’re actively exploring and others where trade-offs exist.</p><h4>🧪 Schema Evolution &amp; Data Contracts</h4><p>Right now, handling schema changes across producers (Pub/Sub, Kafka) and consumers (StarRocks, APIs) is manual and fragile. We’re exploring:</p><ul><li>Schema registry integration (e.g., Confluent Schema Registry)</li><li>Enforced <strong>data contracts</strong> between producers and downstream consumers</li></ul><h4>🐘 High-Cardinality Metrics &amp; Joins</h4><p>StarRocks handles high-concurrency and massive ingest well, but:</p><ul><li><strong>Joins across large datasets</strong> can get expensive in real time</li><li><strong>High-cardinality dimensions</strong> (e.g., user-level analytics) need careful modeling to avoid bloated tables or slow queries</li></ul><p>We’re experimenting with <strong>materialized views</strong>, <strong>pre-aggregations</strong>, and even <strong>hybrid models</strong> (mixing real-time + batch where needed).</p><h4>🏞️ Lakehouse Integration</h4><p>As we continue to scale our real-time data platform, we’re exploring how to integrate it with <strong>lakehouse architecture</strong> — to bridge the gap between streaming, historical, and analytical workloads.</p><p>Currently, StarRocks serves as our high-speed analytical engine, but it doesn’t store long-term, large-volume datasets. Integrating with a lakehouse would enable us to:</p><ul><li><strong>Persist raw + processed data</strong> in an open format (e.g., Parquet, Iceberg, or Delta Lake)</li><li>Enable <strong>retrospective analysis</strong> beyond the retention period of StarRocks</li><li>Run <strong>AI/ML workflows</strong> and <strong>batch analytics</strong> on historical data without overloading our real-time pipeline</li><li>Support <strong>replays</strong> or <strong>reprocessing</strong> from deep storage when business logic changes</li></ul><p>The long-term goal is to have a <strong>fully unified architecture</strong>:<br> 🌊 <em>Data is streamed, stored, queried, and analyzed — across real-time and historical timelines — from one logical platform.</em></p><p><em>Authors: </em><a href="https://www.linkedin.com/in/swapnesh-khare-21272480/"><em>Swapnesh Khare</em></a><em>, </em><a href="https://www.linkedin.com/in/abhaykansal/"><em>Abhay Kansal</em></a>, <a href="https://www.linkedin.com/in/shaurya-goel/"><em>Shaurya Goel</em></a>, <a href="https://www.linkedin.com/in/atul-anand-jha/"><em>Atul Anand {Jha}</em></a><em>, </em><a href="https://www.linkedin.com/in/azmd801/"><em>Azhar M</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=095711edf1b2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cars24-data-science-blog/%EF%B8%8F-real-time-all-the-time-how-we-streamed-data-from-everywhere-into-dashboards-and-apis-in-095711edf1b2">⚡️ Real-Time, All the Time: How We Streamed Data from Everywhere into Dashboards and APIs in…</a> was originally published in <a href="https://medium.com/cars24-data-science-blog">CARS24 Data Science Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Convert Detectron2 model to TensorRT]]></title>
            <link>https://medium.com/cars24-data-science-blog/convert-detectron2-model-to-tensorrt-efb3f3cd62b1?source=rss-405aa4037783------2</link>
            <guid isPermaLink="false">https://medium.com/p/efb3f3cd62b1</guid>
            <category><![CDATA[tensorrt]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[detectron2]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[triton-inference-server]]></category>
            <dc:creator><![CDATA[Swapnesh Khare]]></dc:creator>
            <pubDate>Wed, 12 Oct 2022 07:43:09 GMT</pubDate>
            <atom:updated>2022-10-13T06:08:57.963Z</atom:updated>
            <content:encoded><![CDATA[<p>This post covers the steps needed to convert a <a href="https://github.com/facebookresearch/detectron2">Detectron2</a> (<strong>MaskRCNN</strong>) model to <a href="https://developer.nvidia.com/tensorrt">TensorRT</a> format and deploy it on <a href="https://github.com/triton-inference-server/server">Triton Inference Server</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*3ieqhC2PhrTvsBwcUC40jg.jpeg" /></figure><p>By default, there is no easy way to deploy a Detectron2 model through Triton. There is no <a href="https://github.com/triton-inference-server/backend">backend</a> as such in Triton which supports this. The workaround is to use python backend in config.pbtxt and write your own python code to load the model and predict, which runs on Triton. While this is somewhat an easy task, as of Triton 22.08, we cannot have more than 1 such models deployed through Triton on Kubernetes (<a href="https://github.com/triton-inference-server/server/issues/3678">issue</a>).</p><p>To resolve this, we need to convert our Detectron2 model to TensorRT and use tensorrt_plan backend. The blog follows this <a href="https://github.com/NVIDIA/TensorRT/tree/main/samples/python/detectron2">tutorial</a>, but with easier setup, optimizations and detailed steps to help others avoid getting stuck :)</p><p>The scripts required for the conversion can be found in the same <em>tutorial</em> repository.</p><h4>Prerequisites</h4><ol><li>Trained Detectron2 MaskRCNN model (.pth/.pkl file) and model config.yaml</li><li>The model is trained on <strong>square </strong>images. The conversion scripts currently only support square image dimensions (<a href="https://github.com/NVIDIA/TensorRT/tree/main/samples/python/detectron2#detectron-2-deployment">ref</a>)</li><li>An example image to adjust dimensions of tensors</li><li>Docker installed on system with GPU (change docker run command for CPU only system)</li></ol><h4>Step 1: Create Docker image to run conversion scripts</h4><p>We first need to create a docker image with required packages to run the conversion scripts. Some PyTorch and TensorRT dependecies are needed, for which we can use thepytorch image from <strong>NVIDIA NGC </strong>and install other dependencies over it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/02d8d571d5e40be86598297604f6ca12/href">https://medium.com/media/02d8d571d5e40be86598297604f6ca12/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f3b822b646fd6fa35c39d5db80b2c8d/href">https://medium.com/media/0f3b822b646fd6fa35c39d5db80b2c8d/href</a></iframe><p>We have to use onnx==1.8.1 as onnx.optimizer is moved to another repo since 1.9 . Create the custom image:</p><pre>docker build -t custom-pytorch:22.08 .</pre><pre>docker run -p 8888:8888 --gpus all -it --rm custom-pytorch:22.08</pre><p>Once inside the container, we can run Jupyter:</p><pre>jupyter notebook --port=8888 --ip=0.0.0.0 --allow-root --no-browser .</pre><p>And access it on localhost&lt;or VM ip&gt;:8888 . The token to login will be shown on the terminal.</p><h4>Step 2: Run conversion scripts</h4><p>First, we need to upload all the scripts located <a href="https://github.com/NVIDIA/TensorRT/tree/main/samples/python/detectron2">here</a> to Jupyter.</p><p>Next, download jupyter notebook from this <a href="https://github.com/swapkh91/detectron2-to-tensorrt">repo</a> and upload it to Jupyter. This notebook contains the commands which are to be executed to convert the model. Make sure to run the cells in order and make necessary changes to the scripts as suggested in the notebook.</p><p>While running the cells, you will see warning logs of missing operators for Onnx conversion. It is normal. Onnx currently doesn’t support these operators and that’s why we cannot directly use the Onnx model but instead, create a TensorRT engine which contains these operators.</p><p>The generated trt file can now be used for inference.</p><h4>Step 3 (Optional): TensorRT Optimizations</h4><p>Now that our model has been converted to TensorRT, we can optimize our model for better throughput.</p><p><strong>Change precision</strong></p><p>TensorRT gives us the option to change network precision level, which by default is FP32. There are a few <a href="https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#trtexec-flags">options</a> to choose from and the choice depends on whether <strong>lowering the precision distorts the model’s prediction</strong> or not. For example, add --fp16 flag to tensorrt conversion command in the notebook:</p><pre>!trtexec --onnx=converted.onnx --saveEngine=engine.trt --useCudaGraph --fp16</pre><p>This will change precision to FP16, which can increase the throughput of the model multifold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*HPIvNXadcNWG7Maury6V2g.png" /><figcaption>Performance summary with fp32 (on NVIDIA T4)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*fEB7o0RHTuSqTalGlnkWFA.png" /><figcaption>Performance summary with fp16 (on NVIDIA T4)</figcaption></figure><p><strong>Change batch size</strong></p><p>By default the model has a batch size of 1. Depending on the usecase and available resources, we can change the model’s batch size. This can be done by adding --batch_size flag to Caffe2 to Onnx conversion step:</p><pre>!python create_onnx.py --onnx converted.onnx --exported_onnx model.onnx --det2_config config.yml -s new.jpg --det2_weights region.pth --batch_size 4</pre><h4>Step 4: Deploy TensorRT engine to Triton Inference Server</h4><p>The converted TensorRT model can now be deployed on Triton using the tensorrt_plan backend. Rename the .trt file to model.plan as expected by Triton. Model repository structure should be as follows:</p><pre>&lt;model-repo (model-repository-path)&gt;/<br>    &lt;maskrcnn (model-name)&gt;/<br>      [config.pbtxt]<br>      &lt;1 (version)&gt;/<br>        &lt;model.plan (model-file)&gt;<br>      ...<br>    ...</pre><p>Below is a sample config.pbtxt :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/408100377ab2ecf02f2c47afee003e79/href">https://medium.com/media/408100377ab2ecf02f2c47afee003e79/href</a></iframe><p>The Triton Server version used here is same as that of pytorch image, i.e. 22.08 . Other versions might not contain the operators needed by TensorRT.</p><p>To load the converted model on Triton locally, run the following command:</p><pre>docker run --gpus all --rm -p8001:8001 -p8000:8000 -p8002:8002 -v  &lt;full-path-to-model-repo&gt;:/models nvcr.io/nvidia/tritonserver:22.08-py3 tritonserver --model-repository=/models</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*FoGpzfKJjCLDPsduldBelQ.png" /><figcaption>Mask generated by Detectron2</figcaption></figure><p>Triton can also be deployed on Kubernetes as per <a href="https://github.com/triton-inference-server/server/tree/main/deploy/gcp">this</a> doc.</p><h4>Conclusion</h4><p>Detectron2 makes Object Detection simple and quick. But this simplicity is only useful if it can be deployed with scale and performance :)</p><p><em>Authors: </em><a href="https://www.linkedin.com/in/swapnesh-khare-21272480/"><em>Swapnesh Khare</em></a><em>, Senior ML Engineer @ CARS24, </em><a href="https://www.linkedin.com/in/archit-jain30/"><em>Archit Jain</em></a>, <em>Data Scientist @ CARS24</em></p><h4>References</h4><ol><li><a href="https://github.com/swapkh91/detectron2-to-tensorrt">Notebook</a></li><li><a href="https://github.com/NVIDIA/TensorRT/tree/main/samples/python/detectron2">Official conversion doc</a></li><li><a href="https://github.com/triton-inference-server/server/tree/main/deploy/gcp">Triton on GKE</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efb3f3cd62b1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cars24-data-science-blog/convert-detectron2-model-to-tensorrt-efb3f3cd62b1">Convert Detectron2 model to TensorRT</a> was originally published in <a href="https://medium.com/cars24-data-science-blog">CARS24 Data Science Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ML in Production @ CARS24 (Part 2)]]></title>
            <link>https://medium.com/cars24-data-science-blog/ml-in-production-cars24-part-2-6a717340d8e6?source=rss-405aa4037783------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a717340d8e6</guid>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[ml-model-deployment]]></category>
            <category><![CDATA[cars24]]></category>
            <category><![CDATA[ml-monitoring]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Swapnesh Khare]]></dc:creator>
            <pubDate>Fri, 24 Jun 2022 11:36:49 GMT</pubDate>
            <atom:updated>2022-06-24T12:32:50.822Z</atom:updated>
            <content:encoded><![CDATA[<p>In our <a href="https://medium.com/cars24-data-science-blog/ml-in-production-cars24-part-1-e712f54e20a2">previous post</a>, we gave a small introduction to MLOps and few shortcomings of ignoring MLOps practices in production.</p><p>This blog post focuses on how those practices are followed at Cars24 and their impact on the workflows.</p><h3><strong>Static Files</strong></h3><p>Static files are broadly of 2 types in our workflows, Data files (CSV, JSON, Pickle) and Model files. We have moved both of these types out of Git Repos into their respective stores.</p><p><strong>Data Files<br></strong>These files mainly contain model features, static data (make, model, variant info) etc. Such information is either needed once or with every request. Loading the entire data into the memory when only a few rows of data is needed per request is not ideal.</p><p>We load these files in a <strong>Feature Store</strong> instead, for which we have used <a href="https://feast.dev/"><strong>Feast</strong></a>. Feast serves the following use cases:</p><ul><li>Low latency feature retrieval (≤10ms)</li><li>Consistency between training/serving data</li><li>Maintain history of data</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*s2EBjup501K2tcGuLcdAKA.png" /><figcaption>Feature Store Workflow</figcaption></figure><p><strong>Model Files<br></strong>We have moved the model files out of code repos to a <strong>Data Store</strong> managed by <a href="https://dvc.org/"><strong>DVC</strong></a> (explained below). These are fetched and loaded once during initialization. If a new model is uploaded in the Data Store, we can simply call a method (<em>load()</em>) in our deployment to re-fetch and re-load the new model.</p><p>These two practices give us the following advantages:</p><ul><li>No code build needed due to change in such files</li><li>Memory requirement is reduced</li><li>Docker image size reduced considerably</li><li>Cold-start time reduced during scaling</li></ul><h3>Model/Data Versioning</h3><p>Just like code versioning is done through Git, a versioning mechanism for Model/Data files is also needed. These files now persist in the <strong>Data Store </strong>(GCS buckets) as explained above.</p><p>The versioning tool we use is <a href="https://dvc.org/"><strong>DVC</strong></a>. It is similar to git but for model/data files. It gives us the following advantages:</p><ul><li>DVC attaches with every git commit to track files, which solves the problem of <em>‘What goes with what</em>’</li><li>DVC enables us to move model/data files to a remote storage</li><li>DVC has git-like commands so its easy getting used to</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*qB-UVj5q-zFDHVLYYslxHw.png" /><figcaption><a href="https://dvc.org/doc/use-cases/versioning-data-and-model-files">Git+DVC flow</a></figcaption></figure><h3><strong>Inference Service</strong></h3><p>We deploy our ML Workflows on GKE, called <em>Inference Services</em>. These Inference Services are created using <a href="https://github.com/kserve/kserve"><strong>KServe</strong></a>, an open-source tool to make model serving easy. KServe minimises the deployment efforts while providing options to tweak settings depending on the person’s expertise.</p><p>A few points on why we chose KServe:</p><ul><li>KServe standardised the code structure for any Inference Service</li><li>We don’t have to worry about scaling. <a href="https://knative.dev/docs/"><strong>KNative</strong></a>, which integrates with KServe takes care of that. If needed, we can easily tweak the autoscaling parameters</li><li>Option to fetch models from remote storage (<em>Data Store</em>)</li><li>Easy integration with external predictors like <a href="https://github.com/triton-inference-server/server"><strong>Triton Inference Server</strong></a></li><li>Scale-to-Zero functionality by KNative</li><li>Canary Deployment</li></ul><p>Here we also have control over machine type, <strong>Compute Optimised</strong> machines can be used on GKE depending on the use-case. One GKE cluster can run multiple Inference Services (or multiple instances of a service) on a single node to maximise resource utilisation. A <strong>queue-proxy</strong> runs behind each Inference Service which queues incoming requests and triggers scaling (depending on the scaling parameters) which prevents request failure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-I0O8AvPeGQvOkGp2cHRzw.png" /><figcaption><a href="https://github.com/kserve/kserve/blob/master/docs/diagrams/kserve.png">KServe Inference Service Structure</a></figcaption></figure><h3><strong>Monitoring</strong></h3><p>Monitoring of ML deployments is an essential and often ignored practice. Not only do we need to monitor the model’s performance, but also of the service as a whole (helps to optimise code/cost). We monitor every <em>Inference Service </em>as follows:</p><ul><li>All internal logging is stored in GCP Logs. These logs are automatically archived in GCS if needed.</li><li>Alerting is set up on the logs, which in case of error, triggers an email to the stakeholders</li><li>Further monitoring is done on <em>KServe</em> side through <a href="https://prometheus.io/"><strong>Prometheus</strong></a> and <a href="https://grafana.com/"><strong>Grafana</strong></a>, which give better insights on the service’s performance</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EwhkCRN-G1LLGfknP9Fy1g.png" /><figcaption>Sample ML Workflow Architecture</figcaption></figure><h3><strong>Conclusion</strong></h3><p>The points listed here don’t cover even 50% of what can be done through the right ML system design. Our plan as MLOps practice at CARS24 was to first solve the problems around deployment and monitoring for scale and reliability, which are the most essential parts as the company grows.</p><p>In the next post, we will discuss about a few enhancements we did to these <em>Inference Services</em> and their impact.</p><p><em>Authors: </em><a href="https://www.linkedin.com/in/swapnesh-khare-21272480/"><em>Swapnesh Khare</em></a><em>, Senior ML Engineer @ CARS24, </em><a href="https://www.linkedin.com/in/rajesh-dhanda/"><em>Rajesh Dhanda</em></a><em>, ML Engineer, </em><a href="https://www.linkedin.com/in/abhaykansal/"><em>Abhay Kansal</em></a><em>, Staff Data Scientist @ CARS24</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a717340d8e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cars24-data-science-blog/ml-in-production-cars24-part-2-6a717340d8e6">ML in Production @ CARS24 (Part 2)</a> was originally published in <a href="https://medium.com/cars24-data-science-blog">CARS24 Data Science Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>