Learning Objectives
By the end of this chapter, you will be able to:
- Compare blue-green and canary deployment strategies and evaluate their suitability for high-traffic applications.
- Implement a model rollout strategy using Databricks Model Serving with traffic configuration, served entities, and alias-driven promotion.
- Register a custom PyFunc model and log custom artifacts in Unity Catalog, including code paths, dependencies, and signatures.
- Query custom models via REST API or MLflow Deployments SDK using the supported request payload formats.
- Deploy custom model objects using the MLflow Deployments SDK, the REST API, the Databricks SDK, and the Serving UI.
Executive Summary
- Blue-green and canary rollouts on Mosaic AI Model Serving are both implemented through the same primitive: a single endpoint with multiple
served_entitiesand atraffic_configthat splits invocation requests by percentage. - Blue-green flips traffic atomically from one served entity to another; canary ramps gradually with intermediate splits like 95/5, 80/20, 50/50 before reaching 100/0.
- The Unity Catalog model registry pairs naturally with serving aliases:
@championresolves to the production version while@challengeris staged behind a partial traffic split so failures stay bounded to the canary slice. - Custom PyFunc models package any Python inference function as an MLflow model with
artifacts,code_paths, andpip_requirements; logging throughmlflow.pyfunc.log_modelwithregistered_model_name="catalog.schema.model"writes the version directly to Unity Catalog. - Endpoints accept three input payload shapes:
dataframe_split,dataframe_records, andinputs; queries land through the REST/serving-endpoints/{name}/invocationsroute or throughmlflow.deployments.get_deploy_client("databricks").predict(...).
Assumptions
- The reader has completed Chapter 1 (SparkML pipelines, MLflow tracking, Feature Engineering in Unity Catalog) and Chapter 2 (deploy-code strategy, Databricks Asset Bundles, Lakehouse Monitoring, automated retraining).
- All examples assume Unity Catalog is the active model registry; the workspace model registry surface is treated as deprecated and only referenced where it changes a serving behavior.
- All endpoint names, served entity names, catalog and schema names, and route names are fictional placeholders used consistently across examples (catalog
prod_ml, schemarisk, modelsclaims_classifier,fraud_scorer,recommendation_ranker). - Region, networking, and private-link configuration are out of scope; the chapter assumes a workspace where Mosaic AI Model Serving is enabled and the user has
CAN MANAGEon the registered models andCAN CREATE ENDPOINTon the workspace.
