Sub topic 2
How Feast Is Organized: Registry, Offline Store, Online Store
This chapter assumes you know the basic machine learning workflow (training data, features, labels, inference), can read Python and pandas code, and are comfortable running commands in a terminal. It explains the three parts of Feast that every later chapter builds on: the registry, the offline store, and the online store. It also shows how they connect to the feature repository you write.
The big picture
Feast is a layer between your data and your models. It does not replace your warehouse, your stream processor, or your model server. Instead it keeps track of what your features mean and moves their values between storage systems.
Feast has three main components:
- Registry: the catalog of definitions. It records which entities, data sources, feature views, and feature services exist.
- Offline store: the compute and storage layer used to read large amounts of historical data. It is used to build training sets and to feed materialization.
- Online store: a low-latency key-value store holding the latest value of each feature for each entity. It is used at inference time.
You describe features once in Python. Feast then uses those definitions to read history from the offline store and to serve the latest values from the online store. Using the same definitions on both paths is how Feast reduces training-serving skew, which is the mismatch between the features a model saw in training and the features it sees in production.
The registry
The registry stores metadata, not feature values. Each time you run feast apply, Feast reads your repository definitions and writes them to the registry. Later, when you call get_historical_features or get_online_features, Feast looks up the feature view in the registry to find out:
- which data source holds the values,
- which entity and join keys identify a row,
- the schema (feature names and types),
- the TTL, which limits how far back a value is considered valid,
- which feature services group which features.
The registry can live in different places. The simplest option is a local file, which is what the example configuration below uses. Teams that share a repository usually move the registry to a shared location such as an object store bucket or a SQL database, so that every user and service sees the same definitions.
Because the registry is the source of truth for definitions, a change you make in Python has no effect on retrieval until you run feast apply. This is a common source of confusion: you edit a feature view, but retrieval still behaves as before because the registry still holds the old version.
The offline store
The offline store is where historical feature data is read from. It is built for throughput and large scans. A single training job may read millions of rows spanning months, and latency of seconds or minutes is acceptable.
Feast supports several offline store types. The file type reads Parquet files and processes them with pandas-style operations. It needs no infrastructure, so it is useful for learning and tests. Production setups commonly use a warehouse or query engine such as BigQuery, Snowflake, or Redshift.
The offline store has two jobs:
- Historical retrieval.
get_historical_featuresjoins feature values onto a list of entity rows, using the timestamp of each row so that the join is point-in-time correct. A later chapter covers this in detail. - Source for materialization. When you materialize, Feast reads the latest values from the offline store and writes them to the online store.
The online store
The online store holds one current set of values per entity key. It is optimized for fast lookups by key, typically within milliseconds, because a prediction request is waiting on it.
The online store is not a copy of the full history. If a driver has 10,000 hourly rows in the offline store, the online store holds only the most recent materialized values for that driver. This is why it can be small and fast, and also why you cannot build a training set from it.
Feast supports several online store types. SQLite is a single-file option for local work. Redis, DynamoDB, and others are used when you need to handle production traffic. The Python API you use to read features does not change when you switch the backend.
The two stores compared
| Property | Offline store | Online store |
|---|---|---|
| Main use | Training sets, backfills, materialization source | Inference-time lookups |
| Data held | Full history with timestamps | Latest value per entity key |
| Access pattern | Large scans and joins | Key lookups |
| Typical latency | Seconds to minutes | Milliseconds |
| Read call | `get_historical_features` | `get_online_features` |
| Local example | Parquet files (`file`) | SQLite |
| Production examples | BigQuery, Snowflake, Redshift | Redis, DynamoDB |
The configuration file
The feature_store.yaml file tells Feast where the registry is and which store types to use. It lives at the root of the feature repository.
project: driver_project
registry: data/registry.db
provider: local
online_store:
type: sqlite
path: data/online_store.db
offline_store:
type: fileEach key has a clear role:
projectis a name that scopes your definitions. Two projects can use the same feature view name without clashing.registryis the location of the registry.providerselects the set of defaults and integrations.localmeans everything runs on your machine.online_storeandoffline_storeselect the backends and their settings.
To move from a laptop to production, you usually change this file and leave your feature definitions alone. That separation is a deliberate design choice.
What lives where after setup
Suppose you have a repository with the feature_store.yaml above and a Python file defining an entity, a Parquet source, and a feature view. The following table tracks where each piece sits at each step.
| Step | Registry | Offline store | Online store |
|---|---|---|---|
| Raw data exists | Empty | Parquet file with history | Empty |
| After `feast apply` | Definitions stored | Unchanged | Tables or keys prepared for online feature views |
| After materialization | Unchanged | Unchanged | Latest values per entity |
| After a new row lands in the source | Unchanged | New row visible to historical retrieval | Unchanged until you materialize again |
The last row matters. The online store does not update on its own when source data changes. Something has to run materialization, either on a schedule or through push ingestion, both covered in later chapters.
Running the two core commands
The commands below register definitions and then copy the latest values into the online store.
feast apply
feast materialize-incremental $(date -u +"%Y-%m-%dT%H:%M:%S")feast apply updates the registry. feast materialize-incremental copies values up to the given timestamp into the online store, starting from where the previous run stopped.
Reading from each store
A single FeatureStore object gives you access to both paths. It finds feature_store.yaml in the repository path you give it.
from feast import FeatureStore
store = FeatureStore(repo_path=".")
online_features = store.get_online_features(
features=[
"driver_hourly_stats:conv_rate",
"driver_hourly_stats:acc_rate",
],
entity_rows=[{"driver_id": 1001}],
).to_dict()The feature references use the form feature_view_name:feature_name. Feast resolves the view name through the registry, then reads from the online store. The equivalent call for training data, get_historical_features, uses the same reference format but reads from the offline store.
Common errors
- Feature view not found. You edited a definition but did not run
feast apply, or you are pointingrepo_pathat the wrong directory. - Online features come back as
None. The registry knows the feature view, but nothing has been materialized for that key, or the values are older than the TTL. - Historical retrieval works but online retrieval is empty. These use different stores. Historical retrieval reads the source directly, while online retrieval depends on materialization having run.
- Config changes seem ignored. Feast reads
feature_store.yamlfrom the repository path. Check that you are running from, or pointing at, the intended repository.
Summary of responsibilities
- The registry answers "what features exist and where do they come from?"
- The offline store answers "what were the values over time?"
- The online store answers "what is the value right now?"
Keeping these three roles separate is the core design idea in Feast. Later chapters add entities, sources, and feature views to this structure and then walk through retrieval and materialization in detail.
Exercise
A teammate edits the TTL of a feature view in the Python file and reruns their training script. The training output does not change. Name the likely cause, and say which Feast component holds the stale information.
Show answer
They did not run feast apply, so the registry still holds the old feature view definition including the old TTL. Feast reads definitions from the registry at retrieval time, so the registry is the component with the stale information. Running feast apply updates it.
Exercise
You have materialized features for driver 1001, and then 500 new rows for that driver land in the Parquet source. A service calls getonlinefeatures for driver 1001 a minute later. Does it see the new values? Explain which stores are involved.
Show answer
No. The new rows are in the offline source, so historical retrieval can see them. The online store only changes when materialization (or a push) writes to it. Until you run materialize-incremental again, the service reads the older values already stored in the online store.