skip to content

When you run mlflow server for a team, how do you separate the backend store from the artifact store, and when should clients write artifacts through the server rather than straight to the bucket?

level: seniorimportance: should knowfreq 8%

answer

  1. metadata in a database, files elsewhere
  2. --backend-store-uri for metadata
  3. --artifacts-destination with serving on
  4. mlflow-artifacts:/ versus s3:// locations
  5. fixed when the experiment is created

basics

~20 s

Point --backend-store-uri at PostgreSQL or MySQL for metadata and --artifacts-destination at a bucket for files. Artifact serving is on by default, so clients upload through the server with its credentials; --no-serve-artifacts with --default-artifact-root makes clients write the bucket directly.

solid answer

~50 s

The **backend store** holds metadata — runs, params, metrics, tags, model IDs — in a database: `--backend-store-uri postgresql://...` for a shared server (without it, MLflow 3.7+ uses a local `sqlite:///mlflow.db`). The **artifact store** holds files. `--serve-artifacts` is on by default, so with `--artifacts-destination s3://store-demand-artifacts` new experiments get `mlflow-artifacts:/` locations and clients upload over HTTP; only the server holds bucket credentials, and anyone who can reach the server can reach every artifact it can. With no destination set, files land in `./mlartifacts` on the server's own disk. `--no-serve-artifacts --default-artifact-root s3://...` gives runs `s3://` locations that clients write directly, so every client needs credentials. Proxy when you want one access point and no credentials on clients; go direct when the server must not carry the upload traffic. An experiment's artifact location is fixed when it is created, so switching modes only affects new experiments.

code

bash · 11 lines
bash
# Proxied artifacts: clients need no bucket credentials
mlflow server \
  --host 0.0.0.0 --port 5000 \
  --allowed-hosts "mlflow.internal.example,mlflow.internal.example:5000" \
  --backend-store-uri "$MLFLOW_BACKEND_STORE_URI" \
  --artifacts-destination s3://store-demand-artifacts

# Direct artifacts: every client writes the bucket itself
# mlflow server --no-serve-artifacts \
#   --backend-store-uri "$MLFLOW_BACKEND_STORE_URI" \
#   --default-artifact-root s3://store-demand-artifacts

go deeper

for a junior

Recall the two stores: metadata in a database through --backend-store-uri, files in an artifact store, and that the server can proxy artifact traffic.

for a middle

Explain how --serve-artifacts, --artifacts-destination and --default-artifact-root decide an experiment's artifact location, and what each mode demands from clients.

for a senior

Show the production traps: ./mlartifacts on an ephemeral disk, old experiments keeping direct locations, the proxy's shared access, schema upgrades, binding and allowed hosts.

for a principal

Weigh proxied against direct storage for a shared server — credential spread, audit, throughput, an artifacts-only instance — and who owns the server's storage identity.

## Two stores behind one server An MLflow **tracking server** (`mlflow server`) fronts two separate storage systems: - the **backend store** — a database holding run and model **metadata**: run IDs, model IDs, params, metrics, tags, start and end times; - the **artifact store** — file or object storage holding **artifacts**: model files, plots, prediction CSVs. They scale and fail differently. Metadata is many small writes that need indexes for search; artifacts are few, large blobs. Splitting them is the first decision when a team moves off a laptop. ## The backend store - `--backend-store-uri` takes a SQLAlchemy URI: `postgresql://…`, `mysql://…`, `mssql://…` or `sqlite:///…`. Its environment variable is `MLFLOW_BACKEND_STORE_URI`. - Without it, MLflow 3.7 and later uses `sqlite:///mlflow.db` in the server's working directory (or reuses an existing `./mlruns` file store). The docs suggest PostgreSQL or MySQL for production deployments with high concurrency. - The model registry needs a database-backed store; `--registry-store-uri` defaults to the backend store. - After upgrading MLflow, run `mlflow db upgrade <uri>` before starting the server: it fails against an out-of-date schema. Back the database up first. - `--read-replica-backend-store-uri` routes reads such as `search_runs` to a read-only replica while writes go to the primary. - Deleting a run does not remove its metadata or artifacts from either store; `mlflow gc` removes deleted runs permanently, so storage growth is an operator's job. ## The artifact store: proxied or direct | | Proxied (default) | Direct | |---|---|---| | Flags | `--artifacts-destination s3://…` (serving is on by default) | `--no-serve-artifacts --default-artifact-root s3://…` | | New experiments' location | `mlflow-artifacts:/…` | `s3://…` | | Who talks to the bucket | The server, over its own credentials | Every client | | Client credentials needed | None for storage | Yes, for the bucket | | Upload traffic | Streams through the server, unless proxied multipart upload is enabled | Goes straight to storage | - `--serve-artifacts` defaults to **true**, and `--artifacts-destination` defaults to `./mlartifacts` — a directory on the server's disk, lost with an ephemeral container. - In proxied mode the server resolves `mlflow-artifacts:/` URIs to the destination. Access to storage is configured **once**, on the server, and **every user who can reach the server can reach every artifact it serves** — the proxy is a single access point, not a per-user permission. - Setting `--default-artifact-root s3://…` while leaving serving on still gives new experiments `s3://` locations, so clients write the bucket directly. The documented rule: to proxy, set `--artifacts-destination` and do **not** set `--default-artifact-root`. - With `MLFLOW_ENABLE_PROXY_MULTIPART_UPLOAD=true`, a proxying server hands clients presigned part URLs for large files on Amazon S3 or Google Cloud Storage (500 MB and up by default), so those bytes skip the server while credentials stay on it. - `--artifacts-only` runs a server that handles only artifact requests, so a second instance can carry the large transfers while the main one serves metadata. - Since MLflow 3.15, when artifacts sit directly on Amazon S3 (the non-proxied setup), the UI downloads them through presigned URLs instead of streaming them through the server. ## The location is fixed per experiment An experiment records its **artifact location when it is created**, and each run's `artifact_uri` derives from it. Changing server flags does not rewrite existing experiments: 1. Experiments created under `--no-serve-artifacts` keep writing `s3://` paths after the server switches to proxying, so their clients still need credentials. 2. To move clients onto the proxy, create **new experiments** after the switch. 3. MLflow's client caches artifact locations per run, so a run's location should not change while it is still running. ## Opening the server to the team - `mlflow server` binds `127.0.0.1:5000` by default and accepts only local connections. Pass `--host 0.0.0.0` in a container or VM. - Since MLflow 3.5 a security middleware guards against DNS rebinding and CORS attacks; with `--host 0.0.0.0`, list the names clients use in `--allowed-hosts` (and browser origins in `--cors-allowed-origins`); left unset, it allows only localhost and private IP addresses. Its options work only with the default uvicorn server, not together with `--gunicorn-opts` or `--waitress-opts`. ## Choosing Proxy when clients should hold no storage credentials and one audited entry point matters more than throughput. Go direct when artifacts are large and frequent enough that the server becomes the bottleneck even with multipart upload — and accept that every training job then carries bucket credentials.

  • A team switched its MLflow server to proxied artifacts, yet clients still fail with S3 permission errors. Why?
    The failing runs belong to experiments created before the switch. An experiment's artifact location is recorded at creation, so those experiments still hand clients `s3://` paths to write directly. Create new experiments after enabling proxying — they get `mlflow-artifacts:/` locations — or keep giving those clients credentials until the old experiments are retired.
  • Why can a proxied MLflow server become an access-control problem?
    In proxied mode the server reaches storage with its own credentials, configured once at startup. Every user who can reach the server can then upload and download every artifact those credentials allow. The proxy centralises access; it does not scope it per team, so access to the server must be controlled in front of it.
  • The server was started with no artifact flags in a container. Where did the artifacts go?
    Into `./mlartifacts` on the container's filesystem: serving is on by default and `--artifacts-destination` defaults to that local directory. When the container is replaced the files are gone while the database still points at them. Set `--artifacts-destination` to object storage.

  • Artifacts are stored in the backend database alongside params and metrics
  • With proxied artifacts, each client still needs its own bucket credentials
  • Setting --default-artifact-root alone makes the server proxy uploads to that bucket
  • Changing the server's artifact flags moves existing experiments to the new location
  • The proxy enforces per-user permissions on artifacts

Assumes MLflow 3.16; the SQLite default backend dates from 3.7, the security middleware from 3.5, and presigned UI downloads for direct S3 artifacts from 3.15.