Principle:4paradigm OpenMLDB Stream Data Ingestion
| Knowledge Sources | |
|---|---|
| Domains | Streaming, Data_Ingestion |
| Last Updated | 2026-10-12 12:00 GMT |
Overview
A data ingestion pattern where streaming message brokers (Kafka, Pulsar) continuously deliver real-time data into a database for immediate query processing.
Description
Stream data ingestion connects external messaging systems to a database so that incoming data is automatically written to online tables without manual intervention. In OpenMLDB, Kafka and Pulsar connectors subscribe to topics, parse messages according to a schema mapping, and write rows into OpenMLDB online tables. This enables real-time feature computation: as new events arrive, they are immediately available for deployed SQL queries to compute up-to-date features.
The key problem solved is data freshness: batch-loaded data has inherent latency between event occurrence and feature availability. Stream ingestion minimizes this latency to seconds or sub-seconds.
Usage
Use this principle when building real-time ML pipelines where features must reflect the most recent events. Common use cases include real-time fraud detection, recommendation systems, and monitoring dashboards.
Theoretical Basis
Stream ingestion follows the publish-subscribe pattern with schema-aware ingestion:
Where:
Latency_brokeris message delivery time (typically < 10ms)Latency_ingestis connector write time to OpenMLDBLatency_queryis deployed SQL execution time (sub-millisecond)
Pseudo-code for stream ingestion:
# Abstract algorithm (NOT real implementation)
def stream_ingest(topic, table_schema):
consumer = subscribe(topic)
while True:
messages = consumer.poll()
for msg in messages:
row = parse(msg, table_schema)
openmldb.insert(table, row)
# Data now available for deployed queries
Practical Guide
- Configure the connector with the correct schema mapping from message fields to table columns
- Ensure the OpenMLDB table schema matches the connector's expected schema
- Monitor consumer lag to detect ingestion bottlenecks
- Use partitioned topics for higher throughput