|
|
|
|
|
by twic
945 days ago
|
|
> Dynamic safety (cells, Rcs, etc) just add too many overhead for the the critical path A low latency trading system can't have Rc, or any C equivalent of it, in the critical path, because it does allocation. More generally, your story doesn't ring true to me, because the performance-critical parts of a low latency trading system have to be so simple that there isn't scope for any of the tricky bits you talk about, they have to be braindead simple loops over simple data structures. One of my colleagues wrote a low latency trading system in Rust. He had to learn Rust to do it, already knew C, and today thinks this was the right decision. |
|
Hu, so it doesn't ring true because... you feel like it's too complicated from what you imagined? That's a first.
> that there isn't scope for any of the tricky bits you talk about, they have to be braindead simple loops over simple data structures
That is far from the reality of low latency trading systems. Let's just look at the very first building blocks:
1) You will need some form of userspace packet polling, along with its associated multicast A/B line arbitration. That alone is not "simple braindead loops", and we're just talking about getting 1 UDP datagram here.
2) You will need some form of packet queueing before decoding, so that you do not drop packets under bursts. That most likely means some variant of lock free ring buffer in shared memory. Far from "a bunch of brain dead loops" as well.
3) You will need to decode packets and maintain an order book state. That mostly implies a purpose built b+tree. If you've implemented any of those, you will know it's also far from simple.
4) You will have to compute some indicators based on order book state, which most likely will lead you to some form of linear algebra.
5) You will need to disseminate such indicators to perform some simple close formula variant of portfolio optimization. More linear algebra.
6) etc.
I'm happy your colleague that he managed to do all that without struggling, that was not my experience, that's all. But to say that it's "just braindead loops over simple datastructures" is either a sign he didn't do a _real_ low latency system, or he just was somehow spared from the real underlying complexity.