Scrivio Interview library
DesignAdvanced6 min read · updated 12 November 2026

Your company is choosing a standard format for data stored long-term, such as event archives kept for seven years, that must stay readable by future services. Compare options and set rules.

For data kept for seven years, the format must be readable without the code that wrote it, so we choose a schema-based format such as Avro for event records or Parquet for analytical tables, or well-specified JSON with a published schema when readability matters most. The schema is stored with the data or in a registry with retention at least as long as the data, Java-serialized objects are never archived, and written evolution rules let new readers read old records. Finally, a scheduled job regularly reads the oldest archives to prove they are still readable.

Why this question is asked

Archives are written once and read rarely, which makes them easy to neglect. Seven years is longer than most services live: in that time the language version will change several times, the original team will move on, and the classes that produced the data will be refactored or deleted. The first time someone needs the data, for an audit, a legal request or a model rebuild, is exactly when we find out whether the format was a good choice. Interviewers ask this to see whether we design for the reader who arrives years later. In this answer, we will set the requirements, compare the candidate formats, explain how to keep schemas alive, write the evolution rules, and show how to test readability continuously.

1What Long-Term Storage Requires

The defining requirement is independence from the code that wrote the data. A reader in seven years may be a new service in a different language, an analytics engine, or an auditor's tool. It must be able to understand every record using only the stored files and documentation that is kept with them. Second, the format must handle change, because the event structure will evolve over seven years and every generation of records must remain readable. Third, it must be practical at volume, compact and compressible, and readable by common tools, such as Spark, query engines and standard libraries, that are likely to still exist.

2Comparing the Candidates

Java-serialized objects fail the first requirement completely: they depend on specific class names and versions, which will not exist in seven years, and reading them is a security risk. Plain JSON without a schema is readable, but its meaning lives in people's heads, its types are vague, and every reader has to guess. The serious options are formats that carry or reference a schema.

Formats for a seven-year archive
FormatSchema locationFit
Java serializationJava class versionsnever: needs old classes; unsafe to read
Plain JSONnowhereweak: meaning and types are guessed
JSON + JSON Schemaschema file per versiongood for small, human-inspected archives
Avro container filesin every file headergood default for event records
Parquetin every file footerbest for large analytical tables
Protobufseparate .proto filesfine if the .proto files are archived too

Avro stores the writer's schema in the header of each container file, so a file is self-describing, and its resolution rules let a reader with a newer schema read older records by field name. Parquet is a columnar format with the schema in its footer, ideal for large analytical tables that are queried by column. Protobuf is compact and well supported, but its messages carry only field numbers, so the .proto files must be archived alongside the data. Well-specified JSON, newline-delimited with a JSON Schema per version, is the most readable and fits smaller archives where people inspect records by hand.

3Keeping the Schema as Long as the Data

Data without its schema is just bytes. With Avro and Parquet, the schema travels inside every file, which is the strongest guarantee. If a schema registry is used, for example when events are archived straight from Kafka where each message carries only a schema id, the registry becomes part of the archive: its retention must be at least as long as the data's, and we regularly export its schemas into the archive storage itself, next to the data, so the archive does not depend on a running registry service in 2033.

Alongside the schemas, we store a short, plain description of each field: its meaning, unit, and allowed values. A field called amount means nothing in seven years unless the documentation says it is an integer number of euro cents including tax.

4Rules That Make Evolution Safe

We write the evolution rules down and check them automatically when a schema changes. New fields are added with a default value, so old records can be read by new readers. Fields are never renamed in place; Avro aliases can map an old name to a new one. A field's type is never changed except for safe widenings that the format's rules allow, and an old field's meaning never changes; a new meaning needs a new field. Removed fields stay documented, because old records still contain them.

JSON
{
"type": "record", "name": "OrderPlaced", "namespace": "com.acme.events",
"fields": [
{"name": "orderId", "type": "string"},
{"name": "placedAt", "type": {"type": "long", "logicalType": "timestamp-millis"}},
{"name": "amount", "type": {"type": "bytes", "logicalType": "decimal", "precision": 12, "scale": 2}},
{"name": "currency", "type": "string", "doc": "ISO 4217 code"},
{"name": "channel", "type": "string", "default": "web", "doc": "added in v2"}
]
}

Notice the choices for long-lived types: timestamps as UTC with an explicit unit, money as a decimal type with precision and scale instead of a floating-point number, currency as a standard code, and the v2 field with a default. Each choice removes a question that a reader in seven years would otherwise have to guess at.

5Testing That Old Archives Stay Readable

A format is only proven readable when something reads it. We run a scheduled job, monthly for example, that takes a sample of files from each year of the archive, the oldest included, and reads them with the current production reader code and with a generic tool that knows nothing about our classes. It checks that every record parses, that key fields have plausible values, and that row counts match the manifest written at archive time. A failure becomes an incident, because it means the archive is decaying while we still have time to fix it.

Step throughMonthly archive readability check
  1. Pick sample files per yearalways include the oldest
  2. Read with current reader codeand with a generic tool, no app classes
  3. All records parse and checksums match?
    Yesrecord success on the dashboardNoopen an incident: archive decaying
  4. Check schema changesnew schema must read every older sample

4 steps in order. Play them, or step through them one at a time.

We add the same check to the pipeline that changes schemas: a new schema version is accepted only if it can read sample files written with every previous version. Together with the schemas stored in the archive and a manifest with checksums per file, this turns readability from a hope into a measured property.

6Follow-up questions

Should we compress the archives?

Yes, with a standard, widely supported codec such as gzip, zstd or Snappy inside the format, as Avro and Parquet support. We avoid unusual codecs, because the reader in seven years must still have a library for them, and we record the codec in the manifest.

Is JSON good enough for seven years?

It can be, if it is well specified: one record per line, a JSON Schema per version stored with the data, explicit conventions for dates, decimals and ids, and the same evolution rules. It is larger than Avro or Parquet, so it fits smaller archives or ones that people inspect by hand.

What about encryption keys?

If archives are encrypted, the keys or key references are part of the format's survival plan: key retention and rotation must cover the full seven years, and the readability test should decrypt with the production key path.

7Conclusion

In this answer, we chose formats for a seven-year archive by one test: can it be read without the code that wrote it. Schema-based formats such as Avro and Parquet, or well-specified JSON with JSON Schema, pass it; Java-serialized objects never do. We keep the schema with the data or in a registry with matching retention, write evolution rules so new readers can read old records, choose explicit long-lived types, and run a regular job that reads the oldest archives to prove they still work.

What to say in the interviewAbout 90 seconds aloud

Open with

My starting point is that the archive must be readable by someone who has none of our code, because in seven years the classes, the team and maybe the language will have changed.

Then, if they want more

That rules out Java serialization completely; it depends on specific class versions and is unsafe to read. It also rules out schema-less JSON for anything important. I would choose Avro container files as the default for event records, because every file carries its writer schema in the header and Avro's resolution rules let a newer reader read older records.

For large analytical tables I would use Parquet, which carries its schema in the footer and is efficient for queries. Well-specified JSON with a JSON Schema per version is fine for small archives people inspect by hand, and Protobuf is acceptable only if the .proto files are archived with the data.

If we use a schema registry, its retention must match the data's and we export the schemas into the archive itself.

Then I would set evolution rules: add fields only with defaults, never rename in place or change a field's meaning, only safe type widening, plus long-lived types like UTC timestamps with units and decimals instead of doubles, with field documentation.

Finally, a monthly job reads sample files from every year, including the oldest, with current code and a generic tool, and any failure is treated as an incident.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Your company is choosing a standard format for data stored long-term, such as event...": https://scrivio-interview-library.netlify.app/java/serialization/7bcad78ba0/