Apache Avro
- Problem solved: exchange and store structured data compactly and quickly, across languages, without generating code, while letting schemas evolve without breaking programs that read older data.
- Era: proposed on April 2, 2009, Hadoop subproject on April 10, 2009, version 1.0.0 on July 9, 2009, Apache top-level project on April 21, 2010.
- Category: data and file serialization format (with RPC).
- Created by: Doug Cutting, with Sharad Agarwal, both Hadoop committers.
Historical context
In 2009, the Hadoop ecosystem processes petabytes and wants to combine data from any origin "on-the-fly, using scripting and interactive tools". Common formats do not keep up: "XML and JSON are expressive, but they're big, and slow to process", writes Doug Cutting. Google uses Protocol Buffers, and Thrift follows the same approach, but these systems expect code to be generated from a schema known in advance, which complicates life for dynamic languages and generic tools.
Hadoop also suffers from its own RPC protocol, which "requires its clients and servers to run the exact same version of Hadoop". On April 2, 2009, Doug Cutting proposes a new subproject on the Hadoop list, with a clear ambition: "for Avro to replace both Hadoop's RPC and to be used for most Hadoop data files, e.g., by Pig, Hive, etc.". The only two authors of the code at that point are Cutting and Sharad Agarwal.
Avro joins the ASF as a Hadoop subproject on April 10, 2009 and publishes version 1.0.0 in July 2009. The reception is not unanimous: under Cutting's introduction post in November 2009, a reader writes "The world doesn't need another serialization mechanism". Cutting replies that Protocol Buffers and Thrift only record field numbers, without the names or full types. The ASF board makes Avro a top-level project on April 21, 2010, announced on May 4 along with five others, including HBase.
Avro then finds its place far beyond Hadoop: the specification uses the example of records stored "for several weeks in an Apache Kafka topic", Confluent's Schema Registry supports it alongside Protobuf and JSON Schema, and Iceberg writes its manifest files in Avro in versions v1 to v3 of its format.
Key idea
The schema travels with the data. An Avro file starts with its schema (written in JSON); after that, records are encoded in binary, with no field names or numbers. As Martin Kleppmann puts it: in Protocol Buffers, "every field in a record is tagged, whereas in Avro, the entire record, file or network connection is tagged with a schema version".
To read, Avro confronts two schemas: the writer's (used to write the data) and the reader's (the one the program expects). Resolution rules translate one into the other: a missing field gets its default value, an unknown field is ignored. This is what makes schema evolution possible without rewriting old data.
How it works
- JSON schemas: primitive types (
int,long,string,bytes...) and complex ones (record,enum,array,map,union,fixed). - Compact binary encoding: integers are written with variable length and zig-zag coding, so a point with small coordinates fits in 2 bytes. Code generation is an optional optimization, mostly useful for statically typed languages.
- Container files: a header (the bytes
Objfollowed by 1, metadata including the schema, a random 16-byte sync marker), then possibly compressed blocks. The markers let a file be split across several MapReduce tasks. - Type promotion: a written
intcan be read aslong,floatordouble, afloatasdouble, and so on. - Sorting without deserialization: Avro binary data can be compared directly, without rebuilding objects.
- Single messages: for a standalone message (for example in Kafka), the "single object" encoding adds a 2-byte marker and an 8-byte schema fingerprint; Confluent's Schema Registry instead prefixes a version byte and a 4-byte schema ID.
{
"type": "record",
"name": "Point",
"fields": [
{"name": "x", "type": "int"},
{"name": "y", "type": "int"},
{"name": "label", "type": "string", "default": ""}
]
}
A program reading, with this schema, points written before label was added
gets the default value ""; an old program reading the new points simply
ignores label.
By the numbers
| Figure | Context | Source |
|---|---|---|
| 2 | Initial committers, Doug Cutting and Sharad Agarwal (April 2009) | Proposal email |
| 8 days | Between the proposal (April 2, 2009) and becoming a Hadoop subproject (April 10, 2009) | Email, Avro blog |
| 200 bytes for 100 points | Possible size of 100 points with small coordinates thanks to zig-zag (November 2009) | Doug Cutting's post |
| 6 | New top-level projects announced together by the ASF, including Avro and HBase: a record (May 2010) | ASF press release 2010 |
| 16 bytes | Size of the sync marker between blocks of a container file | Avro specification |
| 4 bytes | Size of the schema ID placed in front of each message by Confluent's Schema Registry | Confluent docs |
Milestones
- April 2, 2009: Doug Cutting proposes Avro as a Hadoop subproject.
- April 10, 2009: Avro joins the ASF as a Hadoop subproject.
- July 9, 2009: version 1.0.0 (date of the files in the ASF archive).
- November 2, 2009: Doug Cutting introduces Avro on the Cloudera blog.
- April 21, 2010: the board establishes the Apache Avro project, chaired by Matt Massie.
- May 4, 2010: the ASF announces six new top-level projects, including Avro and HBase.
- December 5, 2012: Martin Kleppmann publishes his comparison of schema evolution in Avro, Protocol Buffers and Thrift.
- November 21, 2023: new logo, a paper airplane.
- August 5, 2024: Avro 1.12.0 is released; 1.12.2 follows on August 12, 2026.
Did you know?
- A borrowed logo: the old logo was derived from that of a defunct British aircraft manufacturer, a legal risk the ASF did not want to take. Since 2023 it has been replaced by a paper airplane designed by Emma Kellam, meant to evoke "'fast', 'small' and 'efficient'".
- No field numbers: "Notice that there are no tag numbers in the schema!", stresses Martin Kleppmann. Without the writer's schema, the bytes of an Avro record cannot be read.
- A debate as early as 2009: "The world doesn't need another serialization mechanism. What it needs is for Hadoop to employ one or more of them", objected a reader of Cutting's post, who defended storing full types with the data.
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Controlled schema evolution (defaults, ignored fields, promotions) | The writer's schema is required to read |
| Compact binary, no repeated field names | Row-oriented format, less suited than Parquet to analytical queries |
| Generic reading without code generation | Schemas must be distributed (file, registry, fingerprint) |
| Splittable files for parallel processing | Standalone messages need an extra envelope format |
What came next
- Kafka and schema registries, where Avro acts as the contract between producers and consumers.
- Parquet and ORC for columnar storage of analytical tables, often fed from Avro streams.
- Iceberg, which stores its manifests in Avro (formats v1 to v3) and accepts Avro as a data file format.
- Druid and Impala can read Avro data.
Sources
raw-data/apache/avro/avro.md- https://www.mail-archive.com/general@hadoop.apache.org/msg00163.html
- https://avro.apache.org/blog/2009/04/10/avro-joins-apache/
- https://web.archive.org/web/2010/http://www.cloudera.com/blog/2009/11/avro-a-new-format-for-data-interchange/
- https://archive.apache.org/dist/avro/avro-1.0.0/
- https://avro.apache.org/blog/2010/07/15/avro-1.0.0/
- https://www.apache.org/foundation/board/minutes/Avro.html
- https://news.apache.org/foundation/entry/the_apache_software_foundation_announces4
- https://hadoop.apache.org/news/2010-05-xx-avro-hbase.html
- https://avro.apache.org/docs/1.11.1/specification/
- https://avro.apache.org/blog/2023/11/21/new-project-logo/
- https://avro.apache.org/blog/2024/08/05/avro-1.12.0/
- https://avro.apache.org/blog/2026/08/12/avro-1.12.2/
- https://martin.kleppmann.com/2012/12/05/schema-evolution-in-avro-protocol-buffers-thrift.html [S]
- https://docs.confluent.io/platform/current/schema-registry/fundamentals/serdes-develop/index.html
- https://iceberg.apache.org/spec/
- Origin of the name "Avro": not sourced (the logo post only mentions a British aircraft manufacturer).
- Date of 1.0.0: the ASF archive dates the files July 9, 2009, but the "Avro 1.0.0" blog post is dated July 15, 2010 (likely a migration error).
- Did Hadoop eventually replace its RPC with Avro? Not verified.
- Creation date of Confluent's Schema Registry: not sourced.
- The Iceberg v4 specification moves manifests to Parquet: to follow.
- "Row-oriented format, less suited than Parquet to analytical queries": plausible limitation, not sourced here.