Real-time serving
By defining features on top of operational data sources (Redis, JDBC, REST APIs), FeatureMesh becomes a feature platform for production APIs and online ML inference.
What you get automatically
Fast declarative queries: Query Redis, PostgreSQL, and external APIs in a single request. Pre-compile as prepared statements for millisecond latency.
No training/serving skew: Use the exact same feature definitions for batch analytics and real-time inference. What you trained on is what you serve.
No deployment cycles: Change how your systems behave by updating feature definitions. No code changes, no releases, no waiting.
How it works
First, register the real-time sources you need in the feature registry:
CREATE FEATURE REDIS_SRC AS SOURCE_REDIS('redis://localhost:6379' WITH (timeout='100ms'));
CREATE FEATURE POSTGRES_SRC AS SOURCE_JDBC('postgresql://db:5432/prod' WITH (tables=ARRAY['customers']));
CREATE FEATURE API_SRC AS SOURCE_HTTP('https://api.risk.com' WITH (timeout='200ms'));
CREATE FEATURES AS
CUSTOMERS := ENTITY(),
CUSTOMER_ID := INPUT(BIGINT#CUSTOMERS),
-- Profile tier from Redis
PROFILE_TIER := EXTERNAL_REDIS(KEY 'customer:' || CUSTOMER_ID::VARCHAR FIELD 'tier' FROM REDIS_SRC),
-- Customer balance from PostgreSQL
CUSTOMER_DATA := EXTERNAL_VIEW(
'SELECT customer_id, balance FROM %POSTGRES_SRC[customers]'
ON 'SELF.customer_id=%CUSTOMER_ID'
AS ROW(customer_id BIGINT, balance DECIMAL)
),
BALANCE := CUSTOMER_DATA[balance],
-- Credit score from a microservice
CREDIT_SCORE_JSON := EXTERNAL_HTTP(FROM API_SRC WITH (query_params=ROW(CUSTOMER_ID AS id))),
CREDIT_SCORE := JSON_PARSE_AS(CREDIT_SCORE_JSON, TYPE 'ROW(score INT)')[score]
; Then define derived features on top:
CREATE FEATURES AS
ELIGIBLE_FOR_LOAN := (CREDIT_SCORE > 650 AND BALANCE > 1000) OR PROFILE_TIER = 'VIP'
; You can then create a prepared statement...
CREATE FEATURE ELIGIBLE_FOR_LOAN_PS AS
PREPARED_STATEMENT(
ELIGIBLE_FOR_LOAN
USING INPUT CUSTOMER_ID
); And these features are now queryable from anywhere with low latency high throughput for real-time serving:
curl -X POST "http://localhost:10090/v1/featureql" \
-H "Content-Type: application/json" \
-d '{
"statement": {
"id": "ELIGIBLE_FOR_LOAN_PS",
"inputs": {"customer_id": [12345]}
}
}' Better than custom microservices
Logic stays visible: In microservices, business rules get buried in code across repos. In FeatureMesh, every rule is in the registry, queryable, auditable.
One feature, many consumers: ELIGIBLE_FOR_LOAN serves the lending API, mobile app, fraud system, and analytics. One definition, not four implementations that drift apart.
No service proliferation: Instead of spinning up a new microservice for each data need, add a feature definition. Your infrastructure stays simple.