The Python Feature Server is a serving component that provides low-latency online feature retrieval through HTTP and gRPC endpoints. It reads feature values from the online store, applies on-demand transformations when needed, and returns feature vectors for real-time model inference.
This page covers the Python-based implementation of the feature server. For other serving implementations, see Java Feature Server, Go Feature Server and Offline Feature Server. For deployment orchestration, see Kubernetes Operator.
Sources: docs/SUMMARY.md153-157 docs/getting-started/architecture/overview.md
The Python Feature Server operates as a standalone process or embedded within a Python application. It coordinates between the FeatureStore SDK, online stores, and transformation engines to serve features.
Component Responsibilities:
| Component | Location | Responsibility |
|---|---|---|
feature_server module | Inferred from imports | HTTP/gRPC server implementation |
FeatureStore | sdk/python/feast/feature_store.py100-189 | Central coordinator, registry access |
PassthroughProvider | sdk/python/feast/infra/passthrough_provider.py58-90 | Delegates to online store implementations |
OnlineStore | sdk/python/feast/infra/online_stores/online_store.py35-43 | Abstract interface for storage backends |
OnlineResponse | sdk/python/feast/online_response.py | Response wrapper with feature values |
Sources: sdk/python/feast/feature_store.py100-203 sdk/python/feast/infra/passthrough_provider.py58-130 sdk/python/feast/infra/online_stores/online_store.py35-43
The feature server supports multiple deployment configurations controlled through feature_store.yaml.
Configuration Mapping:
| Type | Config Class | Module Path |
|---|---|---|
local | LocalFeatureServerConfig | feast.infra.feature_servers.local_process.config |
mcp | McpFeatureServerConfig | feast.infra.mcp_servers.mcp_config |
Example Configuration:
The configuration is loaded through the RepoConfig class and validated:
sdk/python/feast/repo_config.py230-231 - Feature server field definition
sdk/python/feast/repo_config.py286-289 - Configuration initialization
sdk/python/feast/repo_config.py480-503 - Validation logic
sdk/python/feast/repo_config.py639-646 - Config class factory
Sources: sdk/python/feast/repo_config.py109-112 sdk/python/feast/repo_config.py230-289 sdk/python/feast/repo_config.py639-646
The core operation of the Python Feature Server is retrieving features from the online store and returning them to clients.
FeatureStore Entry Point:
The get_online_features() method is the primary interface for online retrieval. It doesn't exist directly in the provided excerpt, but is called by the provider:
sdk/python/feast/infra/passthrough_provider.py239-258 - Provider delegates to online store
sdk/python/feast/infra/passthrough_provider.py260-279 - Async variant
Online Store Interface:
Each online store implements the retrieval logic:
sdk/python/feast/infra/online_stores/sqlite.py117-138 - SQLite configuration
sdk/python/feast/infra/online_stores/sqlite.py140-174 - Connection management
Entity Key Serialization:
Entity keys are serialized using a versioned scheme controlled by entity_key_serialization_version:
sdk/python/feast/repo_config.py239-246 - Serialization version config
sdk/python/feast/infra/key_encoding_utils.py - Encoding utilities (referenced)
Sources: sdk/python/feast/infra/passthrough_provider.py239-279 sdk/python/feast/repo_config.py239-246
The Python Feature Server executes on-demand transformations as part of the feature retrieval process. These transformations compute derived features in real-time from stored features and request data.
ODFV Resolution:
The server identifies required ODFVs from feature references:
sdk/python/feast/on_demand_feature_view.py - get_requested_odfvs() method (referenced)
sdk/python/feast/feature_store.py331-333 - ODFV retrieval in historical features context
Transformation Types:
| Mode | Class | Use Case |
|---|---|---|
| Pandas | PandasTransformation | Vectorized operations on DataFrames |
| Python | PythonTransformation | Row-level processing with Python functions |
| Substrait | Substrait plans | Cross-language SQL-like expressions |
sdk/python/feast/transformation/pandas_transformation.py - Pandas mode (referenced at import)
sdk/python/feast/transformation/python_transformation.py - Python mode (referenced at import)
Write to Online Store:
ODFVs can optionally write computed values to the online store:
sdk/python/feast/feature_store.py647-656 - ODFV inference and write flag
sdk/python/feast/feature_store.py689-695 - Materialization of ODFVs with write flag
sdk/python/feast/feature_store.py899-903 - Collecting ODFVs with write_to_online_store=True
Sources: sdk/python/feast/feature_store.py331-333 sdk/python/feast/feature_store.py647-656 sdk/python/feast/transformation/pandas_transformation.py sdk/python/feast/transformation/python_transformation.py
The Python Feature Server communicates using Protocol Buffer messages defined in the feast.serving package.
Proto Imports:
sdk/python/feast/feature_store.py81-87 - Serving and type protos
sdk/python/feast/protos/feast/serving/ServingService_pb2.py - Service definitions
sdk/python/feast/protos/feast/types/Value_pb2.py - Value types
sdk/python/feast/protos/feast/types/EntityKey_pb2.py - Entity key types
Response Construction:
The server builds responses with field status information:
sdk/python/feast/protos/feast/serving/ServingService_pb2.py - FieldStatus enum
sdk/python/feast/online_response.py - OnlineResponse wrapper class
Type Conversion:
Values are converted between Python native types and Proto types:
sdk/python/feast/type_map.py - python_values_to_proto_values() (referenced)
sdk/python/feast/utils.py46-49 - Proto value imports
sdk/python/feast/utils.py267-280 - Arrow to proto conversion
Sources: sdk/python/feast/feature_store.py81-87 sdk/python/feast/utils.py267-280
The Python Feature Server supports multiple deployment patterns for different operational requirements.
| Mode | Use Case | Pros | Cons |
|---|---|---|---|
| Embedded | Single application | No network overhead, simpler | Not shared across services |
| Standalone HTTP | Microservices | Language-agnostic, cacheable | Network latency |
| Standalone gRPC | High-throughput | Binary protocol, streaming | Requires gRPC client |
| Kubernetes | Production at scale | Auto-scaling, HA | Operational complexity |
The FeatureStore class acts as both client and server:
sdk/python/feast/feature_store.py100-178 - FeatureStore initialization
sdk/python/feast/feature_store.py204-219 - Registry refresh mechanism
Server CLI:
The CLI starts a web server that wraps the FeatureStore:
sdk/python/feast/feature_store.py41 - feature_server module import
Referenced: feast serve command implementation
Operator Resources:
infra/feast-operator/README.md1-27 - Operator overview
infra/feast-operator/config/samples/kustomization.yaml1-6 - Sample configurations
docs/how-to-guides/feast-on-kubernetes.md1-10 - Kubernetes deployment guide
Multi-Container Pod Structure:
The Operator creates pods with multiple optional containers:
Sources: docs/how-to-guides/running-feast-in-production.md1-27 infra/feast-operator/README.md1-36 docs/how-to-guides/feast-on-kubernetes.md
The feature server maintains a cached copy of the registry for performance. Cache behavior is controlled by configuration:
sdk/python/feast/repo_config.py150-160 - Cache TTL and mode configuration
sdk/python/feast/feature_store.py204-219 - refresh_registry() method
Cache Modes:
| Mode | Behavior | Use Case |
|---|---|---|
sync | Immediate refresh after writes | Consistency required |
thread | Background refresh at intervals | High read volume |
Manual Refresh:
The feature server delegates storage operations to providers:
sdk/python/feast/infra/provider.py41-46 - Provider type mapping
sdk/python/feast/infra/passthrough_provider.py58-90 - PassthroughProvider implementation
Provider Selection:
Providers map to the same PassthroughProvider implementation:
sdk/python/feast/infra/provider.py41-46 - All providers use PassthroughProvider
The feature server supports asynchronous operations for concurrent request handling:
sdk/python/feast/infra/passthrough_provider.py85-89 - Async support property
sdk/python/feast/infra/passthrough_provider.py199-211 - Async write batch
sdk/python/feast/infra/passthrough_provider.py260-279 - Async online features
sdk/python/feast/infra/passthrough_provider.py281-293 - Async online read
Sources: sdk/python/feast/repo_config.py150-160 sdk/python/feast/feature_store.py204-219 sdk/python/feast/infra/passthrough_provider.py85-293
The feature server defines custom exceptions for operational failures:
HTTP and gRPC Status Codes:
Each exception maps to appropriate status codes:
sdk/python/feast/errors.py20-26 - gRPC status code mapping
sdk/python/feast/errors.py25-26 - HTTP status code mapping
sdk/python/feast/errors.py96-102 - NOT_FOUND status codes
Common Exceptions:
| Exception | Status | Scenario |
|---|---|---|
FeatureViewNotFoundException | 404 | Requested feature view doesn't exist |
EntityNotFoundException | 404 | Entity not in registry |
FeastProviderLoginError | 500 | Authentication failure |
InvalidEntityType | 400 | Invalid entity_df type |
sdk/python/feast/errors.py123-128 - FeatureViewNotFoundException
sdk/python/feast/errors.py105-110 - EntityNotFoundException
sdk/python/feast/errors.py185-187 - FeastProviderLoginError
sdk/python/feast/errors.py404-409 - InvalidEntityType
Sources: sdk/python/feast/errors.py17-409
Refresh this wiki
This wiki was recently refreshed. Please wait 5 days to refresh again.