MLflow Tracking Server: where your experiments actually go
How the MLflow tracking server splits metadata from artifacts, what happens on every log call, and how to run it so a team can share it safely.
- ML Platform
- MLflow · tracking server
The problem
Three data scientists are tuning the same churn model. Each one runs mlflow.log_metric(...) on their laptop, so every result lands in a local ./mlruns folder. On Friday someone asks which run produced the model in production and with which hyperparameters. The answer is on a laptop, maybe, if nobody ran rm -rf mlruns to free disk space.
Then you set up a shared tracking server, and new problems appear:
- Training jobs on Kubernetes log metrics, but
log_artifactfails withAccessDeniedon S3. - The UI gets slow once there are 50,000 runs.
- A notebook logging a metric every step makes a 2-hour training job take 3 hours.
All three make sense once you know what the tracking server is: a thin REST API in front of two very different stores.
Every run is written to files on whichever machine trained it. There’s no shared history, no access control, and a model can’t be traced back to its run once that disk is gone.
Every client sends runs to one server. Metadata (params, metrics, tags) goes to a database and artifacts (models, plots, files) go to object storage. Everyone sees, compares and reproduces the same runs.
Real-world analogy
Architecture
Clients call the tracking server's REST API. The server writes run metadata to a SQL database and proxies artifact uploads to object storage.
| Store | Holds | Typical backend | Access pattern |
|---|---|---|---|
| Backend store | experiments, runs, params, metrics (full history), tags, Model Registry | PostgreSQL / MySQL (or local files) | many small writes, searched by UI |
| Artifact store | model files, plots, datasets, any file you log | S3, GCS, Azure Blob, HDFS, local disk | few large blobs, written once |
Splitting them is the key design choice. Metrics need fast filtering and sorting (“runs where val_auc > 0.9, sorted by date”), which databases are good at. Models can be gigabytes, and object storage is cheap and durable for that. Neither store does the other’s job well.
Two ways to handle artifacts
How the client reaches the artifact store is the setting that most often causes trouble:
- Direct access. The server tells the client “this run’s artifacts live at
s3://ml-artifacts/1/abc123/artifacts”, and the client uploads straight to S3 using its own cloud credentials. Every notebook and training job needs write access to the bucket. - Proxied access (
mlflow server --artifacts-destination s3://ml-artifacts). The run’s artifact URI becomesmlflow-artifacts:/..., and the client uploads to the tracking server over HTTP. The server writes to S3. Only the server needs bucket credentials.
mlflow server \
--backend-store-uri postgresql://mlflow:***@db:5432/mlflow \
--artifacts-destination s3://ml-artifacts \
--host 0.0.0.0 --port 5000
Walkthrough
Here is one training run against a server with proxied artifacts:
1/6mlflow.start_run() sends runs/create to the server, which inserts a run row (status RUNNING) and returns a run ID plus the artifact URI.
All steps (text version)
- mlflow.start_run() sends runs/create to the server, which inserts a run row (status RUNNING) and returns a run ID plus the artifact URI.
- log_params(...) writes the parameters. Params are immutable: logging the same key again with a different value is an error.
- In the training loop, log_metric("loss", v, step=i) appends a (key, value, step, timestamp) row. Each call is a separate HTTP request unless you batch it.
- log_model(...) saves the model locally first (weights, MLmodel file, environment spec), then uploads each file to the server over HTTP.
- The server streams the files to S3 under the run's artifact path. The training job never needed S3 credentials.
- end_run() sets the status to FINISHED and records the end time. If the script crashes inside a with-block, the run is marked FAILED instead.
A run’s states:
Where the Model Registry fits
The Model Registry lives in the same backend store. Registering a model doesn’t copy it: it creates a registered model (a name such as churn-classifier) with numbered versions, and each version points back to the run and artifact path it came from. Deployment code then loads by name and alias, for example models:/churn-classifier@champion, instead of a run ID. Aliases replaced the older fixed stages (Staging, Production), which are deprecated.
Failure modes & trade-offs
| Choice | Default | When to change |
|---|---|---|
| Backend store | local files / SQLite | Any shared server: use PostgreSQL or MySQL |
| Artifact access | proxied when --artifacts-destination is set |
Use direct access only if clients already have bucket access and you want to avoid routing large uploads through the server |
| Server workers | a few | Increase (--workers) when many jobs log at once; scale horizontally behind a load balancer, since the server is stateless |
| Metric logging | synchronous | Async or batched for tight training loops |
When not to self-host. If your team is already on Databricks, SageMaker or Azure ML, a managed MLflow tracking server saves you from running the database, upgrades and auth. Self-hosting makes sense when you need it inside your own network, on your own cloud, or at no per-seat cost.
Test yourself
What are the backend store and the artifact store in MLflow, and why are they separate?easy
The backend store holds metadata (experiments, runs, params, metrics, tags, Model Registry) in a database that supports fast search and sorting. The artifact store holds files (models, plots, data) in object storage, which is cheap and durable for large blobs. They’re separate because their access patterns are opposite: many small queryable writes vs. few large ones.
Training jobs can log metrics but log_artifact fails with an S3 permission error. Why?medium
Metrics go through the tracking server, but artifacts are being uploaded directly from the
client to S3, so the job’s own credentials are used, and they lack write access. Either grant the
job bucket access, or run the server with --artifacts-destination so artifacts are proxied
through it. For existing experiments, also check their artifact location, which was fixed when
they were created.
How would you deploy MLflow for a team of 30 data scientists?hard
A stateless tracking server (several replicas behind a load balancer, for example on Kubernetes or
Cloud Run) with a managed PostgreSQL backend store, an object storage bucket as the proxied
artifact destination, and authentication in front (SSO proxy or MLflow auth). Add database
backups, a migration step in the upgrade process, mlflow gc on a schedule, and bucket lifecycle
rules. Clients only get MLFLOW_TRACKING_URI and a token, never bucket credentials.
What does registering a model do, and how should production code load it?medium
It creates a new version of a named model in the registry that points to the run’s logged model
artifacts; nothing is copied. Production code should load by name and alias
(models:/churn-classifier@champion), so promoting a new version means moving the alias, with no
code change or redeploy needed to pick a different run ID.
Logging slowed down a training job noticeably. What do you change?easy
Each log_metric call is a synchronous HTTP request. Log less often, batch metrics with
log_metrics or log_batch, or turn on async logging so requests are sent from a background
thread.
Further reading
Related posts
- Airflow Triggerer: why waiting shouldn't cost a worker
How deferrable operators and the Triggerer let Airflow wait on thousands of external events without tying up worker slots, and where it breaks.