Live data from Hacker News

Amazon Ion – A richly-typed, self-describing, hierarchical serialization format

amzn.github.io

41–50 of 240 posts

Re: Amazon Ion – A richly-typed, self-describing, hierarchical serialization format

#41
post #23

So basically it's Amazon's version of Apache Avro. Avro supports binary/json serialization, schema evolution , logical types (e.g. timestamp) and other cool stuff. https://avro.apache.org/docs/current/spec.html

Avro didn't exist when Ion started development.

Re: Amazon Ion – A richly-typed, self-describing, hierarchical serialization format

#42

Pretty neat, but isn't it like *two* formats: one binary and one textual?

Two representations of the same data structures. Ion text is like JSON, in fact all JSON is valid ion text. Ion text has comments, trailing commas, dates, and unquoted keys. It's a really good alternative to JSON, YAML, or TOML. Ion binary is compact and fast to parse. Values are length prefixed so the parser can skip over unneeded fields or structs, saving time parsing and memory allocated. Common string values, lik…

Do comments persist in binary serialization or is that a lossy one-way operation?

Re: Amazon Ion – A richly-typed, self-describing, hierarchical serialization format

#43

Wow I remember using Ion back at Amazon in 2012. I can’t remember but I think the order data warehouse was using it … I also now remember back to using something that was akin to FaaS but wasn’t called that. I could give them a JAR of some code that would execute on some Ion data for the order data when it changed. Basically FaaS for an ETL pipeline… Crazy how ahead of the times some companies were.

That was a golden age for Amazon engineering. I assume they’re still great, but that stretch from 2004 to 2014 was some incredible advancement.

Re: Amazon Ion – A richly-typed, self-describing, hierarchical serialization format

#44
This reminded me of a tight-packed binary format we used in the trading systems domain almost 20 years ago. Instead of including metadata/field names in each message, it had a central message dictionary that every client/server would first download a copy from. Messages had only type IDs, followed by binary packed data in the correct field order. Because of microsecond latency requirements, we even avoided the serialization/deserialization process by making the memory format of the message and the wire format one and the same. The message class contained the same buffer that you would send/store. The GetInt(fieldID) method of the class simply points to the right place in the buffer and does a cast to int. Application logs contained these messages, rather than plain text. There was a special reader to read logs. Messages were exchanged over raw TCP. They contained their own application layer sequence number so that streams could resume after disconnection.

In that world, lantencies were so low that the response to your order submission would land in your front-end before you've had time to lift your finger off the enter key. I now work with web based systems. On days like this, I miss the old ways.

Re: Amazon Ion – A richly-typed, self-describing, hierarchical serialization format

#45
post #40

I recently implemented a similar (simpler) format https://baremessages.org/ in ruby. First thoughts are: ION pros: - easy to skip around while reading a file - no need to write a schema - backed by amazon so major langs will have impls - good date support - better concatenation, probably better suited to logging than bare ION cons - what's the text format even for? BARE pros: - schemas keep things tightly versioned -…

Ion text is helpful so you can convert ion binary to text for debugging:

Re: Amazon Ion – A richly-typed, self-describing, hierarchical serialization format

#46

It's staggering to me that people keep making these "rich" data formats without sum types. At least to me, the "ors" are just as important as the "ands" in domain modeling. Apart from that, while you can always sort of fake it with a bunch of optional fields I believe that you kind of need a native encoding to a tagged union if you want to avoid bloating your messages.

Genuine question—why would you need a sum type in a self-describing data format?

Re: Amazon Ion – A richly-typed, self-describing, hierarchical serialization format

#49

Earlier quoted context omitted.

Two representations of the same data structures. Ion text is like JSON, in fact all JSON is valid ion text. Ion text has comments, trailing commas, dates, and unquoted keys. It's a really good alternative to JSON, YAML, or TOML. Ion binary is compact and fast to parse. Values are length prefixed so the parser can skip over unneeded fields or structs, saving time parsing and memory allocated. Common string values, lik…

Do comments persist in binary serialization or is that a lossy one-way operation?

Comments don’t persist in binary. Like white space, they are explicitly not part of the data model.

Re: Amazon Ion – A richly-typed, self-describing, hierarchical serialization format

#50
post #44

This reminded me of a tight-packed binary format we used in the trading systems domain almost 20 years ago. Instead of including metadata/field names in each message, it had a central message dictionary that every client/server would first download a copy from. Messages had only type IDs, followed by binary packed data in the correct field order. Because of microsecond latency requirements, we even avoided the serial…

Interesting. Confluent Avro + Schema registry + Kafka uses exactly the same approach - binary serialized Avro datums are prefixed with schema id which can be resolved via Schema registry
Post reply on HN