Feature stores are now standard infrastructure in data-driven products. This guide walks data and analytics engineers through designing and operating a production-grade, low-latency feature store in 2026 that uses Change Data Capture (Debezium), Kafka for durable messaging, stream processing (Kafka Streams or Apache Flink) for feature computation, Apache Iceberg as the analytics/historical store, and Redis as the online store for sub-millisecond lookups.

When to use this architecture

Use this pattern when you need:

  • Sub-millisecond online feature retrieval for model serving.
  • Accurate historical feature materialization for model training and audits.
  • Scalable, multi-tenant feature computation that reuses CDC from production OLTP systems.
  • Deterministic reconciliation and easy rebuilds of the online store from a single source of truth.

High-level architecture

Core components and dataflow:

  1. Source DB (Postgres/MySQL) → Debezium CDC connectors → Kafka (compact topics) — raw change stream.
  2. Stream processor (Kafka Streams / Flink) joins, enriches, and aggregates events to compute feature values; writes two sinks:
    • Iceberg (append/merge) — historical, queryable feature table for training and audits.
    • Compacted Kafka topic (feature events) — canonical record of latest per-key feature state.
  3. Redis online store — populated from the compacted topic by a lightweight consumer (or via stream processor side-effect) to deliver low-latency lookups.
  4. Reconciliation process to rebuild Redis from Iceberg or the compacted topic when drift occurs.

Step 1 — Define features, contracts and SLAs

Before code, define a feature contract for each feature:

  • Entity key (user_id, account_id) and type.
  • Schema (name, type, units), semantic metadata (description, owner).
  • Freshness SLA (e.g., 200 ms for online, 1 hour for analytics snapshots).
  • TTL and retention policy for both online and historical copies.
  • Acceptance tests: value ranges, null rules, and duplicate detection.

Store this metadata in a feature registry (dbt, Feast, or a simple catalog) and subscribe downstream systems to it.

Step 2 — Set up CDC with Debezium

Debezium captures row-level changes and writes them to Kafka. Key settings:

  • Enable tombstones so compacted topics can remove keys properly.
  • Include event timestamp and source LSN/SCN so you can order and deduplicate.
  • Use snapshot.mode=initial for first sync, then incremental.

Sample Postgres connector (abridged):

{
  "name": "dbz-postgres",
  "config": {
    "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
    "database.hostname": "db.prod.example",
    "database.port": "5432",
    "database.user": "replica_user",
    "database.password": "****",
    "database.dbname": "app",
    "slot.name": "debezium_slot",
    "plugin.name": "pgoutput",
    "schema.include.list": "public",
    "snapshot.mode": "initial",
    "tombstones.on.delete": "true",
    "key.converter": "io.confluent.connect.avro.AvroConverter",
    "value.converter": "io.confluent.connect.avro.AvroConverter",
    "transforms": "unwrap",
    "transforms.unwrap.type": "io.debezium.transforms.ExtractNewRecordState",
    "transforms.unwrap.drop.tombstones": "false"
  }
}

Step 3 — Kafka topic design

Design a compacted topic per feature group or entity type so the topic contains the latest per-key state:

  • Name: app.feature.
  • Compaction enabled: cleanup.policy=compact
  • Partition by entity key (consistent hashing) to preserve ordering per entity.
  • Store schema in a registry (Avro/Protobuf) and include versioning in message metadata.

Compacted topics act as the canonical online-state log: they are small to rebuild from and can be consumed by many online consumers.

Step 4 — Stream compute for features

Choose Kafka Streams for tight Kafka integration and exactly-once semantics, or Flink for richer windowing and event-time handling:

  • Use event-time processing with watermarks to handle late-arriving records.
  • Deduplicate using (entity_id, event_id, source_lsn) or by keeping a per-key processed-offset store.
  • Use windowed aggregations for sliding features (e.g., 7-day active count).
  • Enforce idempotency on output by writing the computed feature record keyed by entity and feature version.

Example pseudocode (Kafka Streams):

// read CDC topic
KStream

Step 5 — Materialize analytics history in Iceberg

Iceberg provides ACID and time-travel for historical features. Two practices:

  • Append raw computed feature events into an Iceberg "events" table for lineage/audit.
  • Periodically upsert aggregated feature snapshots into an Iceberg "feature_snapshot" table for training.

Use the Flink Iceberg connector or Spark with MERGE INTO (if using engines that support it). Partition by date and bucketing by entity for scan performance. Preserve event timestamp columns for temporal joins.

Step 6 — Design the Redis online store

Redis schema considerations:

  • Key design: "feature:{feature_name}:{entity_id}".
  • Value format: compact JSON, MsgPack, or Redis Hash; include metadata (value, updated_at, version).
  • Expiration: use TTL only when appropriate — many features are long-lived and TTL can cause unnecessary churn.
  • Memory: estimate cardinality and average value size to provision Redis cluster memory (include replication and overhead).

Example Redis value:

{
  "v": 3.14,
  "updated_at": "2026-11-01T12:34:56.789Z",
  "version": 42
}

Step 7 — Ensuring consistency between sinks

Dual-writes and correctness are the hardest part. Recommended patterns:

  • Make the compacted Kafka topic the single source of truth for online state. The stream processor writes computed features into the compacted topic atomically (via Kafka transactions or KStreams EOS).
  • Have a lightweight consumer that follows the compacted topic and updates Redis asynchronously. Because the compacted topic is append-only with tombstones, the consumer is idempotent and can be replayed.
  • To limit out-of-order writes, partition both the compacted topic and Redis updater by the same key and ensure a single consumer per partition (or use consumer groups with key-based affinity).
  • Optionally implement optimistic concurrency with a version field and Redis conditional set (WATCH/MULTI or Lua scripts) if you must ensure strict in-order application on Redis.

This pattern simplifies recovery: if Redis loses data, you rebuild it by replaying the compacted topic from the beginning or by running a bulk export from Iceberg to the compacted topic.

Step 8 — Reconciliation and rebuilds

Design a fast rebuild path:

  1. From Iceberg: run a job to read the latest snapshot per key and produce to the compacted Kafka topic (use distinct on entity_id with latest updated_at).
  2. From compacted topic: a consumer that writes every record to Redis until fully caught up.

Keep a “rebuild mode” in the updater to avoid evictions during rebuilds and to emit metrics for completion time and drift count.

Step 9 — Monitoring, SLAs and alerts

Essential metrics to collect:

  • Feature freshness: max/avg latency between source event and Redis update.
  • Kafka consumer lag and processing latency per partition.
  • Redis hit/miss rates and update failure rate.
  • Feature value distributions and anomaly detection (sudden spikes or null rate increases).

Set SLOs (e.g., 95% of updates delivered to Redis within 200 ms) and alert on violations. Instrument with Prometheus metrics in stream processors and Redis exporters; visualize in Grafana.

Step 10 — Scaling, cost and operational tips

  • Partition topics by entity to scale consumers; choose partition count to support peak parallelism.
  • Right-size Redis by calculating total keys × avg value size × replication factor × headroom.
  • Use Redis Cluster and client libraries with slot awareness. Keep hot keys in mind — shard by a hashed user id to avoid hotspots.
  • Store long-tail historical data efficiently in Iceberg and avoid keeping rarely used features in Redis.
  • Compress feature values using compact binary encodings to save memory.

Security, governance and testing

Don’t forget:

  • Encrypt data in transit (TLS) and at rest (S3 server-side encryption for Iceberg files; Redis encryption or network isolation).
  • Role-based access: restrict who can write to Kafka topics and Iceberg tables.
  • Data governance: include PII flags in feature metadata; redact or pseudonymize when needed.
  • Automated tests: unit tests for feature logic, integration tests using testcontainers for Debezium/Kafka, and canary deployment for new features.

Practical example: a realistic runbook

  1. Onboard source DB to Debezium; run initial snapshot to a staging topic.
  2. Deploy stream processing job in staging; validate outputs against a reference batch job.
  3. Write computed features to a staging Iceberg table and to a compacted staging topic.
  4. Run the Redis updater until parity with staging compacted topic; run black-box tests against model serving.
  5. Promote to production with canary partitions and ramp traffic over 48 hours.

Checklist before production

  • Feature contracts documented and registered.
  • Compacted topics with correct partitioning & schema registry entries.
  • Stream processor configured with exactly-once or robust idempotency.
  • Redis cluster capacity validated against key cardinality.
  • Rebuild job tested and benchmarked.
  • SLAs, dashboards and alerts in place.

Trade-offs and closing advice

This architecture separates online performance from offline analytics: Redis delivers the speed, Iceberg holds durable history, and Kafka ensures reliable change delivery. The main trade-offs are operational complexity and memory cost for Redis. Keeping the compacted Kafka topic as the canonical online-state reduces the risk of inconsistencies and makes rebuilds straightforward.

Start small: pick a subset of high-value features, run them through this pipeline, measure latency, and iterate. Over time, automate the metadata and testing so that adding features becomes a low-friction, low-risk activity.