MATIH Platform is in active MVP development. Documentation reflects current implementation status.
13. ML Service & MLOps
Online Store (Aerospike)

Online Store (Aerospike / Redis)

The online store provides low-latency feature serving for real-time inference. MATIH supports two online store backends: Aerospike for high-throughput production workloads and Redis for development and lower-scale deployments.


Aerospike Online Store

Aerospike provides sub-millisecond feature lookups at scale with built-in TTL support:

class AerospikeOnlineStore(OnlineStoreBackend):
    def __init__(
        self,
        hosts: List[Tuple[str, int]] = None,  # [("localhost", 3000)]
        namespace: str = "features",
        username: Optional[str] = None,
        password: Optional[str] = None,
    ): ...

Key Structure

Aerospike keys follow the (namespace, set, primary_key) pattern:

def _build_key(self, tenant_id, feature_view, entity_key):
    set_name = f"{tenant_id}_{feature_view}"
    pk = "|".join(f"{k}={v}" for k, v in sorted(entity_key.items()))
    return (self.namespace, set_name, pk)

Write Features

await store.online_store.write_features(
    tenant_id="acme-corp",
    feature_view="customer_features",
    entity_key={"customer_id": "cust-123"},
    features={"total_purchases": 42.0, "avg_order_value": 89.50},
    timestamp=datetime.utcnow(),
    ttl_seconds=604800,  # 7 days
)

Read Features

result = await store.online_store.read_features(
    tenant_id="acme-corp",
    feature_view="customer_features",
    entity_key={"customer_id": "cust-123"},
    feature_names=["total_purchases", "avg_order_value"],
)
# {"features": {"total_purchases": 42.0, "avg_order_value": 89.50}, "timestamp": "...", "entity_key": {...}}

Redis Online Store

Redis provides a simpler alternative with the same interface:

class RedisOnlineStore(OnlineStoreBackend):
    def __init__(
        self,
        host: str = "localhost",
        port: int = 6379,
        password: Optional[str] = None,
        db: int = 0,
        key_prefix: str = "feast:",
        cluster_mode: bool = False,
    ): ...

Key Structure

# Key format: feast:{tenant_id}:{feature_view}:{entity_key_pairs}
# Example: feast:acme-corp:customer_features:customer_id=cust-123

Batch Operations

Both backends support batch reads and writes:

# Batch write
records = [
    ({"customer_id": "c1"}, {"purchases": 10}, datetime.utcnow()),
    ({"customer_id": "c2"}, {"purchases": 25}, datetime.utcnow()),
]
written = await store.online_store.batch_write("acme-corp", "customer_features", records)
 
# Batch read
entity_keys = [{"customer_id": "c1"}, {"customer_id": "c2"}]
results = await store.online_store.batch_read(
    "acme-corp", "customer_features", entity_keys, ["purchases"]
)

TTL Management

Both stores support per-record TTL. Expired records are automatically excluded from reads.


Source Files

FilePath
Aerospike Online Storedata-plane/ml-service/src/features/aerospike_online_store.py
Feast Online Storedata-plane/ml-service/src/features/feast_online_store.py
UnifiedFeatureStoredata-plane/ml-service/src/features/unified_feature_store.py