Day 27: Tracking Large Artifacts: S3 and GCS Backends for MLflow

MLOps Engineering – From Training to Automated Production ~9 min read 60 min hands-on

The Industrialization of Machine Learning: A Comprehensive Guide to Automated Model Lifecycles at Scale

Day 27: Tracking Large Artifacts: S3 and GCS Backends for MLflow

Welcome back, engineers! Today, we’re tackling a crucial piece of the MLOps puzzle that often gets overlooked until it becomes a colossal headache: managing and tracking large machine learning artifacts. If you’ve ever built a sophisticated model, you know it’s not just about the code; it’s about the serialized model files, pre-processed datasets, evaluation plots, custom transformers, and sometimes even entire container images. These aren't small text files; they're often gigabytes, even terabytes, of binary data.

In Day 26, we laid the groundwork for reproducible environments using Conda and Docker with MLflow. Now, imagine you've defined that perfect environment, trained a model, and want to log it. Where does that hefty model file go? If it just sits on your local machine, or worse, in a shared network drive, you've introduced a single point of failure and a major bottleneck for collaboration and scale. This is where the power of cloud-native object storage comes in.

The Elephant in the Room: Why Local Storage Fails at Scale

Think about a system processing 100 million requests per second. This isn't just about fast compute; it's about robust data management. When models are deployed to serve such traffic, they need to be reliably retrieved, potentially across multiple regions, and scaled horizontally. If your MLflow artifacts are stuck on a local disk:

  1. Isolation: Only the machine that ran the experiment has direct access.

  2. Fragility: Disk failure means losing critical model versions.

  3. Scalability Nightmare: How do you serve a model from a local disk to a distributed inference cluster? You don't.

  4. Collaboration Blockade: Teams can't easily share, compare, or deploy models from different experiments.

  5. Cost Inefficiency: Local storage isn't optimized for the varied access patterns of ML artifacts (some accessed frequently, some rarely).

This is why, in real-world systems, we decouple artifact storage from the local machine and even the MLflow tracking server’s metadata store.

Core Concepts: Object Storage as the Immutable Backbone

At its heart, object storage (like AWS S3 or Google Cloud Storage) is designed for storing vast amounts of unstructured data – "objects" – identified by a unique key. It's fundamentally different from a traditional file system.

System Design Concept: Object Storage

Object storage provides:

  • Massive Scalability: Virtually unlimited storage capacity. No need to provision disks.

  • High Durability: Data is replicated across multiple devices and facilities, offering extreme resilience against data loss (e.g., 11 nines of durability for S3).

  • High Availability: Objects are accessible even if some underlying infrastructure fails.

  • Cost-Effectiveness: Pay-as-you-go model, with tiered storage classes (standard, infrequent access, archive) that optimize costs based on access frequency.

  • Immutability and Versioning: Once an object is written, it's generally immutable. If you "update" it, a new version is created, enabling easy rollbacks and auditing – critical for ML model governance.

  • Global Distribution: Data can be stored close to users/compute, reducing latency.

This makes object storage the ideal candidate for storing ML artifacts.

Architecture: MLflow's Dual Storage System

MLflow intelligently separates its storage needs into two distinct components:

  1. Backend Store (Metadata): This stores experiment metadata – parameters, metrics, run status, user info, and pointers (URIs) to artifacts. This is typically a relational database (SQLite, PostgreSQL, MySQL) because it requires transactional consistency and efficient querying of structured data.

  2. Artifact Store (Large Files): This is where the actual large files – models, plots, datasets – reside. This is where we plug in S3, GCS, Azure Blob Storage, or even a local file system (for development).


Keep going with the full lesson

The rest of this lesson β€” plus its implementation guide, runnable scripts and source code β€” is included with the course or an All Access plan. Create a free account to start the free lessons in every course.

Already a member? Sign in