Apache Avro — row-oriented binary data format, developed by ASF (2009). Foundation for serialization in Kafka and streaming systems. Key feature: schema-first (JSON-defined) + schema evolution (add/drop fields backward-compatible). Compact wire format, fast serialize/deserialize. Used by: Confluent Kafka Schema Registry, Apache Pulsar, Airbyte.
Below: details, example, related terms, FAQ.
Free online tool — HTTP header checker: instant results, no signup.
{
"type": "record",
"name": "User",
"fields": [
{"name": "id", "type": "long"},
{"name": "email", "type": "string"},
{"name": "age", "type": ["null", "int"], "default": null}
]
}
# Python (fastavro)
import fastavro
with open('users.avro', 'wb') as out:
fastavro.writer(out, schema, records)Apache Avro is a schema-first data serialization framework primarily used in big data applications. It enables the serialization of data in a compact binary format, ensuring efficient data exchange and storage. Avro schemas are defined using JSON, allowing for easy integration and evolution of data structures. This makes it particularly suitable for use with Apache Hadoop and Kafka, where data processing and streaming are critical.
Apache Avro employs a schema-first approach, meaning that data is serialized according to a predefined schema. This design choice offers several advantages:
To define an Avro schema, you use JSON syntax. Here’s a basic example:
{
"type": "record",
"name": "User",
"fields": [
{ "name": "name", "type": "string" },
{ "name": "age", "type": "int" },
{ "name": "emails", "type": { "type": "array", "items": "string" } }
]
}This schema defines a User record with three fields: name (string), age (integer), and emails (array of strings).
Apache Avro is widely used in various data-intensive applications, particularly in conjunction with big data tools like Apache Hadoop and Apache Kafka. Here are some practical use cases:
KafkaProducer producer = new KafkaProducer(props);
producer.send(new ProducerRecord(topic, "key", user));java -jar avro-tools-1.10.2.jar fromjson --schema-file user.avsc user.json > user.avroimport fastavro
with open('user.avro', 'rb') as f:
reader = fastavro.reader(f)
for record in reader:
print(record)These examples demonstrate how Avro's schema-first design enhances data handling in modern applications, ensuring efficiency and reliability in data processing workflows.
Avro: schema in message/file, dynamic. Protobuf: schema compiled into code. Protobuf more type-safe, but Avro better for streaming with changing schemas.
Avro: streaming (Kafka), one message = one record. Parquet: batch analytics, columnar scans. Complementary.
For Kafka prod — yes. Enforces schema evolution rules, prevents breaking changes. Confluent Cloud or self-host.
Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.