In this lesson, you’ll learn how to choose the right storage formats to handle high-velocity, real-time data streams that require constant, low-latency writes.
The Challenge of Streaming Ingestion
In previous lessons, we focused on batch-optimized columnar formats like Parquet and ORC. While these are excellent for analytical queries, they are "write-once" formats. To update a Parquet file, you generally have to rewrite the entire file or large row groups, which introduces significant latency. For high-velocity streaming, we need formats that support incremental appends.
Append-Friendly Formats
When ingesting data in real-time, the system needs to persist events as they arrive without expensive metadata recalculations. We typically look for two categories of formats for this phase:
- Row-Oriented Formats (e.g., Avro): Unlike columnar formats,
Avrois row-oriented and includes the schema in the file header. Because data is stored as a continuous stream of serialized records, you can simply append new data to the end of the file. This makes it a preferred choice for the initial "ingestion layer" where low-latency writes are mandatory. - Table Formats (e.g., Delta Lake, Iceberg): While these utilize columnar files underneath, they include a "log-structured" metadata layer. When you stream data, these formats write new, small files and update an atomic manifest file. This allows you to achieve low-latency appends while still providing the query benefits of columnar storage.
A Conceptual Illustration
Imagine a stream of sensor data arriving every millisecond. If you used pure Parquet, every append would require re-sorting and rewriting a row group. Instead, the architectural pattern usually looks like this:
-- Ingestion Phase (High Velocity)
-- Stream events into an Avro-backed sink or a Delta Lake append buffer
INSERT INTO sensor_stream_table
VALUES (timestamp_now, sensor_id, value);
By separating the ingestion format (designed for rapid appending) from the query format (optimized for columnar scanning), you can maintain high-velocity throughput without sacrificing your ability to perform complex analytical queries later.
Key Takeaway: To support low-latency streaming ingestion, prioritize row-oriented formats like Avro or table formats that utilize log-structured metadata to allow for efficient, incremental file appends.