Sub topic 17
Moving to production: store choices, scheduling and the feature server
This chapter assumes you can define entities, feature views and feature services, run feast apply, and call get_historical_features and get_online_features. It covers what changes when the local setup from earlier chapters becomes a shared production system. You will choose stores, schedule materialization, serve features over HTTP and handle the common failure modes.
What the local setup cannot do
The local configuration works well for learning. It uses a file-based offline store, an SQLite online store and a registry stored in a local file.
project: driver_project
registry: data/registry.db
provider: local
online_store:
type: sqlite
path: data/online_store.db
offline_store:
type: fileFour things stop this from working in production:
- One machine owns the files. A second service cannot read the SQLite file or the registry on someone else's disk.
- The file offline store does not scale. It reads Parquet files into memory on one machine, so large training sets are slow or fail.
- Nothing runs materialization. Online values go stale unless a scheduler keeps copying them in.
- Every client needs the Feast library and store credentials. Inference services in other languages cannot call
get_online_featuresdirectly.
The production design therefore replaces each local piece with a shared service and adds a scheduler and, usually, a feature server.
Choosing an offline store
The offline store runs the point-in-time joins for training sets and supplies the data that materialization copies. Choose it by where your data already lives. Moving large tables to a different system just to run Feast is expensive and creates its own consistency problems.
| Offline store | Good fit | Watch for |
|---|---|---|
| File (Parquet) | Local development, tests, small data | Single machine, memory-bound |
| BigQuery | Data already in Google Cloud | Query cost for large entity dataframes |
| Snowflake | Data already in Snowflake | Warehouse sizing and credit use |
| Redshift | Data already in AWS Redshift | Cluster capacity during large joins |
The offline store type must match your data sources. A feature view that points at a BigQuery table needs a BigQuery offline store. Data lives in one system, and the offline store pushes the join down into it.
Choosing an online store
The online store holds only the latest value per entity key, so its size depends on the number of entities and features, not on history. The main criterion is read latency under your expected request rate. The second is what your team can already operate.
| Online store | Good fit | Watch for |
|---|---|---|
| SQLite | Local development only | Single file, no network access |
| Redis | Lowest latency, high request rates | Memory cost, persistence settings |
| DynamoDB | AWS deployments, managed scaling | Per-request pricing, regional placement |
| Postgres | Teams that already run Postgres | Throughput limits at very high request rates |
Place the online store in the same region as the model service. A cross-region round trip can cost more than the store's own read time.
A production configuration that uses Snowflake and Redis looks like this. Use environment variable references for secrets so credentials never sit in the repository.
project: driver_project
registry:
registry_type: sql
path: postgresql+psycopg://${FEAST_DB_USER}:${FEAST_DB_PASSWORD}@registry-db:5432/feast
provider: local
online_store:
type: redis
connection_string: "redis-host:6379"
offline_store:
type: snowflake.offline
account: ${SNOWFLAKE_ACCOUNT}
user: ${SNOWFLAKE_USER}
password: ${SNOWFLAKE_PASSWORD}
database: FEATURES
warehouse: FEAST_WH
entity_key_serialization_version: 3Field names differ between Feast versions and store plugins, so check the reference page for your installed version. Run feast version to confirm which one you have. Each store type may also need an extra install, such as pip install "feast[redis,snowflake,postgres]".
A shared registry
The registry records every entity, feature view and feature service. In production, many people and jobs read it, and CI applies changes to it. A registry file on one laptop is not enough.
You have these options:
- File registry on object storage (for example an S3 or GCS path). It is simple. Concurrent writes can overwrite each other, so only one pipeline should run
feast apply. - SQL registry on Postgres or MySQL. It handles concurrent readers and writers better and is the usual choice for teams.
- Remote registry served by a Feast server, so clients need no direct database credentials.
Whichever you pick, treat the feature repository as code. Review changes in pull requests, and run feast apply from CI after merge, not from individual machines. This keeps the registry in step with the repository and gives you an audit trail.
Scheduling materialization
Materialization copies the latest feature values from the offline store into the online store. Nothing does this automatically. You need a scheduler such as cron, Airflow, Kubernetes CronJob or your cloud's workflow service.
The command from earlier chapters is the core of the job:
feast apply
feast materialize-incremental $(date -u +"%Y-%m-%dT%H:%M:%S")In production, the job usually runs only materialize-incremental, because feast apply belongs in CI. Incremental materialization remembers the last end time it processed for each feature view and continues from there, so repeated runs do not reload old data.
The same job can be written in Python, which makes it easier to add logging and alerts:
from datetime import datetime, timezone
from feast import FeatureStore
def run_materialization() -> None:
store = FeatureStore(repo_path=".")
end = datetime.now(timezone.utc)
store.materialize_incremental(end_date=end)
print(f"Materialized up to {end.isoformat()}")
if __name__ == "__main__":
run_materialization()Pick the schedule from two numbers: how quickly your source data updates and how stale a prediction can be. If the source updates hourly and the model tolerates a few hours of delay, an hourly job is enough. Running more often than the source updates adds cost and no new data.
Design the job with these rules:
- Make it safe to rerun. Materialization writes the latest value per key, so repeating a window gives the same result.
- Alert on failure and on lateness. A silent failure means the online store keeps serving old values until the TTL expires and features return null.
- Avoid overlapping runs. Configure the scheduler so a slow run is not started a second time.
- Size the job for the data. A full backfill of a long window is far larger than an hourly increment. Run backfills separately.
The feature server
Python code can call get_online_features directly. Many production systems prefer a separate service that exposes the same operation over HTTP. Start it from the repository directory:
feast serve --host 0.0.0.0 --port 6566A client in any language then posts a JSON request:
import requests
response = requests.post(
"http://localhost:6566/get-online-features",
json={
"features": [
"driver_hourly_stats:conv_rate",
"driver_hourly_stats:acc_rate",
],
"entities": {"driver_id": [1001, 1002]},
},
timeout=2,
)
response.raise_for_status()
print(response.json())The server reads the registry and online store, so inference clients hold no store credentials. Run several replicas behind a load balancer for availability. Registry data is cached and refreshed on an interval, so a newly applied feature view can take a short time to appear. The refresh interval is set in the registry configuration (cache_ttl_seconds).
Use a feature service name where possible. It lets the model team change which features back a model by publishing a new version, without changing client code.
Production gotchas
- Null values after a gap. If materialization stops for longer than a feature view's TTL, values expire and requests return null. Alert before this happens.
- Mismatched definitions. If the online store holds values for an older feature view schema, apply the change and re-materialize the affected view.
- Timezone mistakes. Pass UTC timestamps. A local-time end date can skip or repeat data.
- Large entity dataframes. For training, a very large entity dataframe is uploaded to the warehouse. Keep it to the keys and timestamps you need.
- Unbounded key sets. Online store memory grows with the number of entity keys. Plan capacity before adding a high-cardinality entity.
- Test with production-like data. A local pipeline that passes does not prove the latency or cost of a warehouse-backed one.
Checklist before launch
- Offline store matches where the data lives.
- Online store is in the model service's region and sized for the key count.
- Registry is shared, and only CI runs
feast apply. - A scheduled job runs
materialize-incremental, with alerts for failure and lateness. - TTLs are longer than the schedule interval plus expected delays.
- The feature server runs with more than one replica, and clients use feature service names.
Exercise
Your feature view has a TTL of 2 hours. The materialization job runs every 3 hours, and the source data is fresh. What will online requests show, and how do you fix it?
Show answer
Between the end of the TTL and the next run, values are older than the TTL and requests return null for those features. Fix it by running materialization more often than the TTL (for example every hour), or by raising the TTL to cover the schedule interval plus expected delay, if the model tolerates that staleness.
Exercise
A team wants any application, including a Java service, to fetch features without installing the Python library or holding Redis credentials. What component should they use, and what should the Java service send?
Show answer
They should run the feature server with feast serve. The Java service sends an HTTP POST to /get-online-features with a JSON body that lists the features (or a feature service) and the entity keys.
Exercise
Why should feast apply run from CI instead of from each developer's machine in a shared production setup?
Show answer
Applying from many machines risks conflicting or untested changes to the shared registry, and it leaves no review or audit trail. Running it from CI after a reviewed merge keeps the registry consistent with the repository.