ArticleslgStudy

computer science

Apache Avro

Apache Avro is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Apache Avro rather than just read about it. In short: Avro is a row-oriented remote procedure call and data serialization framework developed within Apache's Hadoop project. It uses JSON for defining data types and protocols, and serializes data in a compact binary format.

Apache Avro — main illustration
Apache Avro — illustration

Key takeaways

  • Apache Avro belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Apache Avro to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Apache Avro from memory before moving on to harder problems.

Reference excerpt

Avro is a row-oriented remote procedure call and data serialization framework developed within Apache's Hadoop project. It uses JSON for defining data types and protocols, and serializes data in a compact binary format. Its primary use is in Apache Hadoop, where it can provide both a serialization format for persistent data, and a wire format for communication between Hadoop nodes, and from client programs to the Hadoop services. Avro uses a schema to structure the data that is being encoded. It has two different types of schema languages: one for human editing (Avro IDL) and another which is more machine-readable based on JSON. It is similar to Thrift and Protocol Buffers, but does not require running a code-generation program when a schema changes (unless desired for statically-typed languages). Apache Spark SQL can access Avro as a data source.

Avro Object Container File An Avro Object Container File consists of:

A file header, followed by one or more file data blocks. A file header consists of:

Four bytes, ASCII 'O', 'b', 'j', followed by the Avro version number which is 1 (0x01) (Binary values 0x4F 0x62 0x6A 0x01). File metadata, including the schema definition. The 16-byte, randomly-generated sync marker for this file. For data blocks Avro specifies two serialization encodings: binary and JSON. Most applications will use the binary encoding, as it is smaller and faster. For debugging and web-based applications, the JSON encoding may sometimes be appropriate.

Schema definition Avro schemas are defined using JSON. Schemas are composed of primitive types (null, boolean, int, long, float, double, bytes, and string) and complex types (record, enum, array, map, union, and fixed). Simple schema example:

Serializing and deserializing Data in Avro might be stored with its corresponding schema, meaning a serialized item can be read without knowing the schema ahead of time.

Example serialization and deserialization code in Python Serialization:

File "users.avro" will contain the schema in JSON and a compact binary representation of the data:

Deserialization:

This outputs:

Languages with APIs Though theoretically any language could use Avro, the following languages have APIs written for them:

C C++ C# Elixir Go Haskell Java JavaScript Perl PHP Python Ruby Rust Scala

Avro IDL In addition to supporting JSON for type and protocol definitions, Avro includes experimental support for an alternative interface description language (IDL) syntax known as Avro IDL. Previously known as GenAvro, this format is designed to ease adoption by users familiar with more traditional IDLs and programming languages, with a syntax similar to C/C++, Protocol Buffers and others.

Logo The original Apache Avro logo was from the defunct British aircraft manufacturer Avro (originally A.V. Roe and Company). The Apache Avro logo was updated to an original design in late 2023.

See also

Comparison of data serialization formats Apache Thrift Protocol Buffers Etch (protocol) Internet Communications Engine MessagePack CBOR

References

Further reading White, Tom (November 2010). Hadoop: The Definitive Guide. O'Reilly Media. ISBN 978-1-4493-8973-4.

Illustrations

Apache Avro illustration

Worked examples

Example 1 — a first encounter with Apache Avro

Start with the simplest possible case. Write down what Apache Avro claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Apache Avro before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Apache Avro ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Apache Avro

In research
Apache Avro appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Apache Avro in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Apache Avro is common in secondary-school and first-year university syllabi. It links to neighbouring topics Apache Software Foundation projects, Application layer protocols, Data serialization formats, so understanding it makes those chapters shorter.
In everyday life
Look for Apache Avro outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Apache Avro” →

How to study Apache Avro in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Apache Avro means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Apache Avro out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Apache Avro in simple terms?

Avro is a row-oriented remote procedure call and data serialization framework developed within Apache's Hadoop project. It uses JSON for defining data types and protocols, and serializes data in a compact binary format.

Why does Apache Avro matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Apache Avro?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Apache Avro.

Tags

  • Apache Software Foundation projects
  • Application layer protocols
  • Data serialization formats
  • Inter-process communication
  • Remote procedure call

Keep exploring