Building Real-Time Feature Stores With Feast and Redis

Data Science
Date:November 17, 2026
Topic:
Building Real-Time Feature Stores With Feast and Redis
⏱ 3 min read

Your model serves predictions in 15 milliseconds. Your feature lookup takes 200. The math doesn't work. Real-time ML dies in the gap between training-serving parity and production latency. Feast and Redis close that gap — if you wire them right.

Why Feature Stores Matter Now

Feature engineering used to be a notebook exercise. Now it's a production contract. Training pipelines and serving paths diverge. Definitions drift. Backfills break. A feature store enforces a single source of truth: define once, compute once, serve everywhere. Feast is the open-source control plane. Redis is the hot path.

Architecture: Control Plane Meets Data Plane

Feast manages metadata — feature definitions, entities, data sources, validation rules. It doesn't store feature values. That's the online store's job. Redis handles point lookups at sub-millisecond latency. The offline store (BigQuery, Snowflake, Parquet) handles training materialization. Feast orchestrates both.

yaml
# feature_repo/feature_store.yaml
project: fraud_detection
registry: s3://feast-registry/fraud/registry.db
provider: local
online_store:
  type: redis
  connection_string: redis://localhost:6379
offline_store:
  type: bigquery
  project: my-gcp-project
  dataset: feast_offline

Define Features Like Code

Features are Python classes, not SQL strings. Version them. Review them. Test them.

python
# feature_repo/features/transaction.py
from feast import Entity, FeatureView, Field
from feast.types import Float32, Int64, String
from datetime import timedelta

user = Entity(name="user_id", join_keys=["user_id"])

transaction_fv = FeatureView(
    name="user_transaction_features",
    entities=[user],
    ttl=timedelta(days=30),
    schema=[
        Field(name="txn_count_7d", dtype=Int64),
        Field(name="txn_amount_avg_7d", dtype=Float32),
        Field(name="merchant_category", dtype=String),
    ],
    source=BigQuerySource(
        table="project.dataset.user_txn_agg",
        timestamp_field="event_timestamp",
        created_timestamp_column="created_timestamp",
    ),
)
💡
TipSet TTLs aggressively. Stale features poison models. 30 days for behavioral, 7 days for session-level.

Materialize to Redis

Feast pushes computed features from the offline store to Redis. Run this as a scheduled job — Airflow, Dagster, cron.

bash
# Incremental materialization (run hourly)
feast materialize-incremental $(date -u +'%Y-%m-%dT%H:%M:%S')

# Full backfill (run once or on schema change)
feast materialize 2024-01-01T00:00:00 2024-12-31T23:59:59

Serve Features in Production

The serving path: client requests features by entity keys. Feast client fetches from Redis. Returns a dict. Model consumes. No SQL. No joins. No latency spikes.

python
# serving/client.py
from feast import FeatureStore
import pandas as pd

store = FeatureStore(repo_path="./feature_repo")

entity_rows = [{"user_id": uid} for uid in ["user_123", "user_456"]]

features = [
    "user_transaction_features:txn_count_7d",
    "user_transaction_features:txn_amount_avg_7d",
    "user_transaction_features:merchant_category",
]

feature_vector = store.get_online_features(
    entity_rows=entity_rows,
    features=features,
)

# Returns dict of lists — ready for model input
print(feature_vector.to_dict())

Monitor Drift Before It Breaks You

Feast tracks feature distribution stats during materialization. Compare serving values against training baselines. Alert on KL divergence > 0.1 or missingness spikes.

python
# monitoring/drift_check.py
from feast.infra.registry.sql import SqlRegistry
import scipy.stats as stats

registry = SqlRegistry(
    registry_config=RegistryConfig(
        path="postgresql://user:pass@host/feast_registry"
    )
)

# Fetch feature stats from registry
feature_view = registry.get_feature_view("user_transaction_features")
# Compare current serving distribution vs training baseline
# Implement your drift detection logic here
⚠️
WarningRedis memory grows fast. Monitor used_memory_human. Evict keys past TTL. Use Redis Cluster for >50M entities.

Production Hardening Checklist

LayerActionTool
RegistryPostgreSQL backend, not SQLiteFeast SQL Registry
Online StoreRedis Cluster + read replicasRedis Enterprise / ElastiCache
MaterializationIdempotent, incremental, monitoredAirflow + Great Expectations
ServinggRPC client, connection poolingFeast Java/Go clients
GovernanceFeature ownership, deprecation policyFeast tags + DataHub

✦

Start This Week

1. Spin up Feast locally: feast init. 2. Define one feature view for your highest-value model. 3. Materialize to a local Redis. 4. Call get_online_features from your serving container. 5. Measure latency. If p99 < 5ms, you're ready to scale. The feature store isn't infrastructure — it's the contract between data and models. Sign it.

Share𝕏 Twitterin LinkedInin Whatsapp