The Python Feature Server is an HTTP and gRPC service wrapper around the FeatureStore class (sdk/python/feast/feature_store.py105-220) that exposes online feature retrieval capabilities through REST and RPC APIs. It is implemented using FastAPI for HTTP endpoints and supports gRPC for efficient binary communication. The server enables non-Python clients to retrieve features from the online store and provides a centralized, stateless service layer for production feature serving.
The feature server is imported and used via the feast.feature_server module (referenced in sdk/python/feast/feature_store.py46).
For information about:
FeatureStore Python SDK directly (embedded mode), see FeatureStore and ConfigurationThe Python Feature Server is a stateless service that wraps the FeatureStore class and exposes its methods via HTTP (FastAPI) and gRPC interfaces. Each request is delegated to a FeatureStore instance (sdk/python/feast/feature_store.py105-220), which uses the configured Provider (sdk/python/feast/infra/passthrough_provider.py58-90) and OnlineStore implementations to serve features.
Sources: sdk/python/feast/feature_store.py105-220 sdk/python/feast/feature_store.py46 sdk/python/feast/infra/passthrough_provider.py58-90 sdk/python/feast/infra/provider.py41-46
Sources: sdk/python/feast/feature_store.py105-220 sdk/python/feast/infra/passthrough_provider.py239-258 sdk/python/feast/infra/provider.py283-320
Sources: sdk/python/feast/feature_store.py105-220 sdk/python/feast/repo_config.py253-317 sdk/python/feast/infra/passthrough_provider.py58-90
The feature server is configured through the feature_store.yaml file. The RepoConfig class (sdk/python/feast/repo_config.py253-364) loads this configuration and provides it to the FeatureStore instance.
The feature_server field in feature_store.yaml is optional:
The configuration class is resolved via the FEATURE_SERVER_CONFIG_CLASS_FOR_TYPE dictionary (sdk/python/feast/repo_config.py109-112):
| Type | Configuration Class |
|---|---|
"local" | feast.infra.feature_servers.local_process.config.LocalFeatureServerConfig |
"mcp" | feast.infra.mcp_servers.mcp_config.McpFeatureServerConfig |
The RepoConfig validates and instantiates the appropriate configuration class via _validate_feature_server_config() (sdk/python/feast/repo_config.py557-580).
| Field | Type | Description | Default |
|---|---|---|---|
project | string | Project identifier | Required |
registry | RegistryConfig | Registry configuration (file/SQL/remote) | Required |
provider | string | Provider type (local, gcp, aws, azure) | "local" |
online_store | OnlineStoreConfig | Online store configuration | sqlite |
offline_store | OfflineStoreConfig | Offline store configuration | dask |
auth | AuthConfig | Authentication configuration | no_auth |
feature_server | FeatureServerConfig | Feature server-specific config | None |
Sources: sdk/python/feast/repo_config.py253-364 sdk/python/feast/repo_config.py109-112 sdk/python/feast/repo_config.py557-580
Local Development:
Production with SQL Registry:
Sources: docs/getting-started/quickstart.md106-118 sdk/python/feast/repo_config.py170-183
The feature server is started using the feast serve CLI command:
The command can be invoked with options:
The CLI command (sdk/python/feast/repo_operations.py414-429):
create_feature_store() which loads feature_store.yaml via load_repo_config() (sdk/python/feast/repo_config.py170-183)FeatureStore instance (sdk/python/feast/feature_store.py124-169)FeatureStore to the feast.feature_server moduleSources: sdk/python/feast/repo_operations.py414-429 sdk/python/feast/feature_store.py124-169
While the feature server is typically started via CLI, you can initialize the underlying FeatureStore programmatically for testing:
The FeatureStore.__init__() method (sdk/python/feast/feature_store.py124-169):
repo_path, config, or fs_yaml_file parametersself.registry (sdk/python/feast/feature_store.py205-219) and self.provider (sdk/python/feast/feature_store.py250-254)Sources: sdk/python/feast/feature_store.py124-169 sdk/python/feast/feature_store.py205-254
The FastAPI-based HTTP interface provides REST endpoints for feature operations:
Retrieves features from the online store for real-time inference. This endpoint wraps FeatureStore.get_online_features() (sdk/python/feast/feature_store.py1500-1652).
Request Format:
Response Format:
The response is an OnlineResponse object serialized to JSON/Proto containing:
The OnlineResponse class encapsulates the feature values, statuses (PRESENT, NOT_FOUND, OUTSIDE_MAX_AGE), and event timestamps.
Sources: README.md137-164 sdk/python/feast/feature_store.py1500-1652
Writes feature values directly to the online store for features backed by a PushSource. This endpoint wraps FeatureStore.push() or FeatureStore.write_to_online_store().
Request: Arrow table or DataFrame containing entity keys and feature values.
Triggers materialization of features from the offline store to the online store. This endpoint wraps:
FeatureStore.materialize() (sdk/python/feast/feature_store.py1900-2034) - Materialize features for a specific time rangeFeatureStore.materialize_incremental() (sdk/python/feast/feature_store.py2036-2133) - Materialize features since last materializationRequest:
Sources: sdk/python/feast/feature_store.py1900-2133
The gRPC interface uses Protocol Buffer definitions for efficient binary communication. The service is defined in feast/protos/feast/serving/ServingService.proto and implemented by the feature server.
Equivalent to the HTTP /get-online-features endpoint but uses Protocol Buffer messages for serialization. The same FeatureStore.get_online_features() method is called internally.
Message Types:
GetOnlineFeaturesRequest - contains feature references and entity values in proto formatGetOnlineFeaturesResponse (sdk/python/feast/protos/feast/serving/ServingService_pb2.py86-89) - contains FieldStatus and feature values as ValueProtoThe response includes:
field_values: Dict mapping feature names to ValueProto objectsmetadata: GetOnlineFeaturesMetadata with feature namesresults: List of GetOnlineFeaturesResponse.FeatureVector with statuses and timestampsReturns metadata about the feature server instance:
Sources: sdk/python/feast/protos/feast/serving/ServingService_pb2.py86-89 sdk/python/feast/feature_store.py1500-1652
The feature server delegates to FeatureStore.get_online_features() which orchestrates the retrieval:
Sources: sdk/python/feast/feature_store.py1500-1652 sdk/python/feast/infra/passthrough_provider.py239-258 sdk/python/feast/infra/online_stores/online_store.py1-30
The FeatureStore caches registry metadata to reduce latency. The registry is lazy-loaded via the self.registry property (sdk/python/feast/feature_store.py205-219):
Cache Configuration:
The RegistryConfig class (sdk/python/feast/repo_config.py136-184) defines:
| Field | Type | Description | Default |
|---|---|---|---|
cache_ttl_seconds | int | TTL for in-memory cache (0 = never expire) | 600 |
cache_mode | string | "sync" (immediate) or "thread" (background) | "sync" |
Cache Behavior:
apply()cache_ttl_seconds intervalsrefresh_registry())Explicit Refresh:
Call FeatureStore.refresh_registry() (sdk/python/feast/feature_store.py273-289):
This method also calls _clear_feature_service_cache() (sdk/python/feast/feature_store.py267-271) to invalidate cached feature service metadata.
Sources: sdk/python/feast/feature_store.py205-289 sdk/python/feast/repo_config.py136-184
For local development and testing, the feature server runs with SQLite online store:
Start the server:
Sources: docs/getting-started/quickstart.md106-118
Deployment Characteristics:
feature_store.yaml configurationSources: docs/how-to-guides/running-feast-in-production.md1-27 infra/feast-operator/README.md1-19
The registry_type: sql triggers SQL registry initialization via SqlRegistry (sdk/python/feast/infra/registry/sql.py). The path must follow SQLAlchemy connection string format. Note the validation in RegistryConfig.validate_path() (sdk/python/feast/repo_config.py170-183) that auto-corrects postgresql:// to postgresql+psycopg://.
Sources: sdk/python/feast/repo_config.py136-184 sdk/python/feast/repo_config.py170-183 docs/how-to-guides/running-feast-in-production.md33-49
The feature server is a thin HTTP/gRPC wrapper around the FeatureStore class (sdk/python/feast/feature_store.py105-220). Each API request maps to a FeatureStore method call.
| HTTP Endpoint | gRPC Method | FeatureStore Method | Line Reference |
|---|---|---|---|
POST /get-online-features | GetOnlineFeatures | get_online_features() | sdk/python/feast/feature_store.py1500-1652 |
POST /push | - | push() or write_to_online_store() | sdk/python/feast/feature_store.py1690-1836 |
POST /materialize | - | materialize() | sdk/python/feast/feature_store.py1900-2034 |
POST /materialize-incremental | - | materialize_incremental() | sdk/python/feast/feature_store.py2036-2133 |
get_online_features() (sdk/python/feast/feature_store.py1500-1652):
materialize() (sdk/python/feast/feature_store.py1900-2034):
materialize_incremental() (sdk/python/feast/feature_store.py2036-2133):
The feature server maintains a shared FeatureStore instance across requests:
PassthroughProvider delegates to online/offline storesRepoConfig is immutable after initializationThe FeatureStore itself maintains minimal mutable state - the _feature_service_cache dict (sdk/python/feast/feature_store.py122) which is cleared on registry refresh.
Sources: sdk/python/feast/feature_store.py105-220 sdk/python/feast/feature_store.py1500-2133 sdk/python/feast/infra/passthrough_provider.py58-90
| Aspect | Python Feature Server | Direct SDK Usage |
|---|---|---|
| Language Support | Any language (HTTP/gRPC) | Python only |
| Deployment | Centralized service | Embedded in application |
| Latency | +1-2ms network overhead | Lowest latency |
| Scaling | Horizontal scaling | Scales with application |
| Registry Caching | Shared across requests | Per-application instance |
| Configuration | Centralized via service | Per-application config |
| Use Case | Microservices, polyglot environments | Python-based ML services |
Sources: docs/getting-started/quickstart.md38 sdk/python/feast/feature_store.py104-223
The registry cache significantly impacts latency. Key considerations:
TTL Setting: Balance between latency and staleness
Cache Mode:
"sync": Immediate consistency, higher latency on writes"thread": Lower latency, eventual consistencySources: sdk/python/feast/feature_store.py208-223 sdk/python/feast/repo_config.py136-161
Different online stores have different latency profiles:
Sources: sdk/python/feast/repo_config.py68-89
The feature server can be configured with different authentication mechanisms:
no_auth): Default, no authenticationkubernetes): Service account token validationoidc): OAuth 2.0 / OpenID Connect integrationConfiguration example:
Sources: sdk/python/feast/repo_config.py114-122 sdk/python/feast/repo_config.py221-223
Sources: docs/how-to-guides/running-feast-in-production.md1-27
Monitor these metrics for production deployments:
get_online_features() callsThe feature server logs key events:
Sources: sdk/python/feast/feature_store.py1-102
High Latency:
Feature Not Found Errors:
feast apply was run to register featuresAuthentication Failures:
Sources: sdk/python/feast/errors.py17-70 sdk/python/feast/feature_store.py208-223
Refresh this wiki
This wiki was recently refreshed. Please wait 3 days to refresh again.