Databricks

Databricks Feature Serving Guide: Online Inference, Feature Delivery, and Online Tables

2026-03-26
更新: 2026-03-27
NicheeLab Editorial Team

When you run ML models online, you need a way to fetch the same features used during training with low latency. Databricks Feature Serving delivers Feature Store tables on Unity Catalog through dedicated endpoints, ensuring training-serving consistency (using the same feature definitions for both training and inference). This article walks through how Feature Serving works, how to configure Online Tables, how to create endpoints, and how to keep training and serving consistent.

Why You Need Feature Serving

Batch inference can read features directly from Delta tables, but for online inference (real-time API requests) querying Delta tables is too slow (seconds to tens of seconds). Feature Serving addresses the following challenges:

ConcernBatch inferenceOnline inference (Feature Serving)
Latency requirementSeconds to minutes (acceptable)Milliseconds to tens of ms (low latency required)
Feature sourceSELECT directly from Delta tablesVia Online Table (KV store)
Training-Serving consistencyNaturally consistent since the same table is readGuaranteed by using the Feature Store as the single definition
ScalabilityDepends on cluster compute capacityAutoscaling on the endpoint

Feature Serving Architecture

[Training]
  │  Feature Engineering in UC
  │  fe.create_training_set(
  │      entity_df, feature_lookups=[...])
  │  → Looks up features at training time
  v
[Feature Table (Delta, UC)]
  │  Source tables
  │  ├─ customer_features (customer_id, avg_spend, ...)
  │  └─ product_features  (product_id, category, ...)
  v
[Online Table]
  │  Incremental sync from Delta (Snapshot / Triggered / Continuous)
  │  → Converted into a low-latency KV store
  v
[Feature Serving Endpoint]
  │  REST API (POST /serving-endpoints/{name}/invocations)
  │  → Returns the feature vector keyed by customer_id
  v
[Model Serving / Application]
  │  Features + real-time input → inference result

Configuring Online Tables

An Online Table syncs a Delta table into a low-latency KV store. Create one by specifying the source Delta table (the Feature Table) and a primary key.

-- Create an Online Table (SQL)
CREATE ONLINE TABLE ml.features.customer_features_online
SOURCE ml.features.customer_features
PRIMARY KEY (customer_id)
SYNC MODE TRIGGERED;
Sync modeBehaviorLatencyCost
SNAPSHOTPeriodically snapshot the entire datasetDepends on the sync interval (minutes to hours)Low
TRIGGEREDManually triggered CDC incremental syncUpdated when the trigger runsMedium
CONTINUOUSAlways-on streaming incremental syncNear real-time (seconds to minutes)High (always running)

Match the primary key to the lookup key on the Feature Table. Composite keys are also supported (for example, PRIMARY KEY (customer_id, product_id)).

Creating a Feature Serving Endpoint

Create a Feature Serving Endpoint with the Python SDK (databricks-feature-engineering).

from databricks.feature_engineering import FeatureEngineeringClient
from databricks.feature_engineering.entities.feature_serving_endpoint import (
    EndpointCoreConfig,
    ServedEntity,
)

fe = FeatureEngineeringClient()

fe.create_feature_serving_endpoint(
    name="customer-features-endpoint",
    config=EndpointCoreConfig(
        served_entities=ServedEntity(
            feature_table_name="ml.features.customer_features",
            scale_to_zero_enabled=True,
        )
    )
)

Setting scale_to_zero_enabled to True scales the endpoint down to zero during idle periods, reducing cost. The trade-off is added latency on cold start — for strict SLAs, set it to False and keep the endpoint warm at all times.

Making Requests to the Endpoint

import requests
import json

endpoint_url = "https://<workspace-url>/serving-endpoints/customer-features-endpoint/invocations"
headers = {"Authorization": "Bearer <token>", "Content-Type": "application/json"}

payload = {
    "dataframe_records": [
        {"customer_id": "C001"},
        {"customer_id": "C002"}
    ]
}

response = requests.post(endpoint_url, headers=headers, json=payload)
features = response.json()
# => {"dataframe_records": [
#   {"customer_id": "C001", "avg_spend": 150.5, "total_orders": 42, ...},
#   {"customer_id": "C002", "avg_spend": 89.2, "total_orders": 15, ...}
# ]}

Achieving Training-Serving Consistency

Training-serving skew — when feature definitions or computations differ between training and inference — is one of the biggest pitfalls undermining ML system reliability. Databricks Feature Engineering in Unity Catalog resolves this structurally:

  • Single feature definition: A Feature Table on UC is the single source for both batch training and online inference
  • FeatureLookup: Use create_training_set to look up features when building the training dataset, and serve from the same table at inference time
  • Model lineage: MLflow logs the feature tables and versions used by each model
from databricks.feature_engineering import FeatureEngineeringClient, FeatureLookup

fe = FeatureEngineeringClient()

training_set = fe.create_training_set(
    df=labels_df,  # Labels dataframe (customer_id, label)
    feature_lookups=[
        FeatureLookup(
            table_name="ml.features.customer_features",
            lookup_key=["customer_id"],
        ),
        FeatureLookup(
            table_name="ml.features.product_features",
            lookup_key=["product_id"],
        ),
    ],
    label="label",
)

training_df = training_set.load_df()

# Log the model (feature lineage is recorded automatically)
fe.log_model(
    model=trained_model,
    artifact_path="model",
    flavor=mlflow.sklearn,
    training_set=training_set,
    registered_model_name="ml.models.recommendation_model",
)

Models logged with fe.log_model embed references to their feature tables. When such a model is deployed to Model Serving, features are automatically looked up via Feature Serving on each inference request (Feature Function).

Design Considerations

ItemRecommendationWhy
Primary key designNatural entity key (e.g., customer_id)Guarantees lookup uniqueness
Feature table granularityOne table per entityBloated tables increase Online Table sync cost
Feature freshness requirementPick the Online Table sync mode that fits the use caseReal-time recommendations → Continuous; daily batch → Snapshot
High-cardinality featuresBucket or categorize during preprocessingKeeps the Online Table's row count and size in check
Endpoint scalingDecide on scale_to_zero based on QPS requirementsLow QPS → scale_to_zero; high QPS → always on

Monitoring Feature Serving

  • Endpoint latency: monitor P50/P99 and set an SLA (for example, P99 < 100ms)
  • Online Table sync lag: monitor the delay between the last source Delta update and the corresponding Online Table refresh
  • Feature drift: enable Lakehouse Monitor on the source feature tables to detect distribution shifts
  • Endpoint error rate: monitor 4xx/5xx rates to catch key mismatches or schema changes

Check Your Understanding

ML Associate / ML Professional

問題 1

An ML engineer is building an online recommendation system. The model was trained by looking up customer features from a Delta table. At inference time, the engineer wants to fetch the same features with low latency and keep the feature definitions identical between training and serving. Which approach is best?

  1. Define a Feature Table with Feature Engineering in UC, sync it to a low-latency KV store via Online Table, and serve it through a Feature Serving Endpoint
  2. Issue SQL queries directly against the Delta table at inference time
  3. Export the training features to CSV and hard-code them inside the inference application
  4. Recover the features from the MLflow model artifact at inference time

正解: A

Centralizing features in Feature Engineering in UC, syncing them to a low-latency KV store via Online Table, and serving them through a Feature Serving Endpoint gives you both training-serving consistency and low latency. Direct queries against Delta cannot meet the latency requirement. CSV exports cannot track feature updates. MLflow model artifacts contain model parameters but not the feature data itself.

Frequently Asked Questions

What is the difference between Feature Serving and Model Serving?

Model Serving deploys the ML model itself as an endpoint that takes input data and returns inference results. Feature Serving is an endpoint that retrieves feature vectors for a given key from a feature table with low latency. A typical setup involves two requests: the client first fetches features via Feature Serving, then passes those features to Model Serving for inference. With Feature Functions, you can also unify the two so Model Serving automatically looks up features internally.

How often is an Online Table updated?

Online Tables support three sync modes: (1) Snapshot — manually or on a schedule, snapshot the entire source Delta table; (2) Triggered — manually triggered incremental sync via CDC (change data capture); (3) Continuous — always-on streaming incremental sync (lowest latency, highest cost). Choose the mode that balances freshness and cost for your use case.

Can features that are not managed by the Feature Store be served via Feature Serving?

Feature Serving endpoints serve features from Feature Store tables on Unity Catalog (Feature Engineering in Unity Catalog). You cannot directly serve a table that is not registered with the Feature Store. However, registering any Delta table as a Feature Store table (a Feature table on UC) is straightforward — use the CREATE FEATURE TABLE statement or the Python API.

Check what you learned with practice questions

Practice with certification-focused question sets

無料で問題を解いてみる
Author

NicheeLab Editorial Team

NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.


Related articles
Databricks

Databricks Certifications: All 7 Exams, Difficulty & Study Plan (2026)

Complete guide to all 7 Databricks certifications — Data Eng...

Databricks

Databricks Exam Difficulty Ranking: All 7 Certs Compared (2026)

Every Databricks certification ranked by difficulty, with st...

Databricks

Databricks Study Guide: Fastest Pass Route & Time Estimates (2026)

How to pass Databricks certifications efficiently. Official ...

Databricks

Databricks Data Engineer Associate: Complete Guide (2026)

Domain-by-domain breakdown of the Databricks Certified Data ...

Databricks

Databricks Data Engineer Professional: Complete Guide (2026)

Tactics for the Databricks Certified Data Engineer Professio...

Browse all Databricks articles (110)
© 2026 NicheeLab All rights reserved.