Live data from Hacker News

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

amzn.github.io

161–170 of 240 posts

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

#161
post #124
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…

Fab story, thank you! I understood up to "Messages were exchanged over raw TCP. They contained their own application layer sequence number so that streams could resume after disconnection." Can you go into more details about how the sequence number and resuming after disconnection worked?

Server used a global sequence number for all messages they transmit. Clients are stateful so they know exactly what was the latest message they processed and would send that id when creating a new connection. This was very important as a lot of the message types used delta values, one of the most important ones being the order book. So in order to apply a new message you had to make sure that you're internal state was at the correct sequence id, failing to do so would make your state go bonkers, specially when you're talking about hundreds of messages being received per second. It's scary but you had a special message type that would send you a snapshot of the expected state with a sequence id that they correspond to. So your error handling code would fetch one of these and them ask for all the messages newer than that.

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

#162

Earlier quoted context omitted.

It does apply, according to https://www.johndcook.com/blog/2017/01/10/probability-of-sec...

But if my application only uses 100 schemas, I only care about a collision if it's with one of those 100.

[deleted]

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

#163
post #124
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…

Fab story, thank you! I understood up to "Messages were exchanged over raw TCP. They contained their own application layer sequence number so that streams could resume after disconnection." Can you go into more details about how the sequence number and resuming after disconnection worked?

Pretty basic. The receiving process usually has an input thread that just puts the messages into a queue. Then a processing thread processes (maybe logic, maybe disk writes, maybe send) the messages and queues up periodic batch acks to the sender. The sender uses these acks to clear its own queue. The receiver persists the last acked sequence number, so that in case of a restart, it can tell upstream senders to restart sending messages from that point.

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

#164
post #161
post #124

Earlier quoted context omitted.

Fab story, thank you! I understood up to "Messages were exchanged over raw TCP. They contained their own application layer sequence number so that streams could resume after disconnection." Can you go into more details about how the sequence number and resuming after disconnection worked?

Server used a global sequence number for all messages they transmit. Clients are stateful so they know exactly what was the latest message they processed and would send that id when creating a new connection. This was very important as a lot of the message types used delta values, one of the most important ones being the order book. So in order to apply a new message you had to make sure that you're internal state wa…

This is exactly right. It was almost always deltas in favor of snapshots. One of the downsides was that sometimes, debugging an issue required replaying the entire market up to the point of the crash/bug.

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

#165
post #127
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…

Is it FIX messages? https://en.wikipedia.org/wiki/Financial_Information_eXchange It's a good idea, extensible (ranges available for banks to implement their own codes), and fast.

It was a proprietary messaging middleware library. We actually found even FAST FIX slow.

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

#166
post #156
post #148

Earlier quoted context omitted.

Old school texty FIX is incredibly slow. FAST FIX is faster but not fun to use. Largely SBE has won adoption on the market data side, with huge platforms like Euronext (biggest on Europe) using it.

I stopped working in the area on the age of FAST FIX, which was extremely good for the time. Do you know what are the differences to SBE?

I guess I'm biased based on experience at the companies I've worked at but FAST never seemed to have good libraries or tooling

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

#167
post #163
post #124

Earlier quoted context omitted.

Fab story, thank you! I understood up to "Messages were exchanged over raw TCP. They contained their own application layer sequence number so that streams could resume after disconnection." Can you go into more details about how the sequence number and resuming after disconnection worked?

Pretty basic. The receiving process usually has an input thread that just puts the messages into a queue. Then a processing thread processes (maybe logic, maybe disk writes, maybe send) the messages and queues up periodic batch acks to the sender. The sender uses these acks to clear its own queue. The receiver persists the last acked sequence number, so that in case of a restart, it can tell upstream senders to resta…

The number of times people have "invented" ASN.1 now is ridiculous.

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

#168

Nice! This thing is actually sane and thought through. A first for serialization formats. They're usually a shitshow. (Should have gone with 'rational' instead of 'decimal', though. Decimal will be too painful to implement accross languages and implementations. Java bias?)

But decimal are way more useful as they can represent currency amounts. It would be strange to show a currency amount like "3/4" or "11/12". Personally, the two datatypes I have always been adding manually to json are datetimes and decimals (from python)

A currency amount is just a rational number with "1000000" as a denominator.

This is the correct representation, and how Google or the blockchain do it.

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

#169
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…

We do something very similar in binlog: https://github.com/morganstanley/binlog

Serialization is platform-dependent (to make it a simple memcpy most of the time), and the schema is sent up front (but can be updated later, with in-bound messages at will). See the User Guide (http://binlog.org/UserGuide.html) and the Internals (http://binlog.org/Internals.html) for more.

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

#170
post #69

Earlier quoted context omitted.

> 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. If the order submission process depends on the manual press on the enter key (+/- 50ms) is there any point to that though?

OT but keyboard latency can and often is far below 50ms, more like 1ms. It seems to be a common misconception that denouncing mandates increased lag.

I was thinking more of the time a human finger needs to push the button down.
Post reply on HN