Live data from Hacker News

LMAX Disruptor – High Performance Inter-Thread Messaging Library

lmax-exchange.github.io

11–20 of 89 posts

Re: LMAX Disruptor – High Performance Inter-Thread Messaging Library

#12

I am working on a C version of the disruptor ringbuffer it is very simple and I need to verify it so it's probably not ready for others but it might be interesting. Aligning by 128 bytes has dropped latency and stopped false sharing. I have gotten latencies to 50 nanoseconds and up. disruptor-multi.c(SPMC) and disruptor-multi-producer.c (MPSC) https://GitHub.com/samsquire/assembly I am trying to work out how to suppo…

Do you think it’s possible to obtain this performance with Rust?

I’ve been down the path you’re on a few times and I love the pursuit. Have built my own over the years about 4 times.

Hardware was much slower in those days so my lower barrier was 650ns. Things got worse appreciably as a function of the number of producers I found.

Some of my most sleepless nights. The funnest nights.

Re: LMAX Disruptor – High Performance Inter-Thread Messaging Library

#15

stupid question: how to build a trading system? anyone got a starter guide, resources?

I built a PoC of a 5us trading system (guaranteed 5us response in every situation) for a brokerage house a long time ago, around the time of LMAX Disruptor. It was one man job and I had to start with nothing (they had no knowledge at all). Fun project and I learned a lot.

* full kernel bypass (I even implemented driver for the networking hardware)

* everything that could disrupt the application disabled (like SME interrupts, etc.) Memory mapped as huge buffers to prevent tlb lookup failures, etc.

* application consists of threads pinned to specified cores

* each thread on the path of market data to sending the order is never calling the operating system for anything. When not processing anything it is busy spinning.

* all memory preallocated carefully to have it pinned to the local core

* data flows from the networking hardware into one core and then passess through cores using disruptor, each core doing further processing and publishing signals to the next core

* the main insight was that rather than wait for market signals to then decide what to do, you can precalculate your responses up to and including the actual message to be sent to the exchange.

Re: LMAX Disruptor – High Performance Inter-Thread Messaging Library

#16

stupid question: how to build a trading system? anyone got a starter guide, resources?

I built a PoC of a 5us trading system (guaranteed 5us response in every situation) for a brokerage house a long time ago, around the time of LMAX Disruptor. It was one man job and I had to start with nothing (they had no knowledge at all). Fun project and I learned a lot. * full kernel bypass (I even implemented driver for the networking hardware) * everything that could disrupt the application disabled (like SME int…

not gonna lie, i have to literally look up the meanings of half the words in your post lol, but you must have been in my position sometime. What did you have to learn in order to build this

Re: LMAX Disruptor – High Performance Inter-Thread Messaging Library

#17
post #11

stupid question: how to build a trading system? anyone got a starter guide, resources?

Not a real system, obviously, but a high level overview of what it does: https://www.kalzumeus.com/2015/10/30/developing-in-stockfigh...

thank you for sharing, it has a few code snippets here and there. Would you be aware of a course or something (Google didnt help) that teaches how to build one from the ground up

Re: LMAX Disruptor – High Performance Inter-Thread Messaging Library

#18

stupid question: how to build a trading system? anyone got a starter guide, resources?

I built a PoC of a 5us trading system (guaranteed 5us response in every situation) for a brokerage house a long time ago, around the time of LMAX Disruptor. It was one man job and I had to start with nothing (they had no knowledge at all). Fun project and I learned a lot. * full kernel bypass (I even implemented driver for the networking hardware) * everything that could disrupt the application disabled (like SME int…

what language do you think would be the backbone for such a system? C/C++/Golang or something high level like node.js/Java

Re: LMAX Disruptor – High Performance Inter-Thread Messaging Library

#19

Earlier quoted context omitted.

I built a PoC of a 5us trading system (guaranteed 5us response in every situation) for a brokerage house a long time ago, around the time of LMAX Disruptor. It was one man job and I had to start with nothing (they had no knowledge at all). Fun project and I learned a lot. * full kernel bypass (I even implemented driver for the networking hardware) * everything that could disrupt the application disabled (like SME int…

what language do you think would be the backbone for such a system? C/C++/Golang or something high level like node.js/Java

Each to their own but if you read and understand the comment above they're describing a dedicated OS for the task .. so think about what you'd choose to write a small task dedicated OS with.

Simple C is most likely, ASM is possible, a language such as OCaml generating C to hook into the low level buffers would be intriguing ... the list is long and largely determined by the experience preference of whoever tackles it.

The major features for performance are to allocate and manage all memory from the start .. determine your thresholds of performance and put everything required together on cold start so as to avoid any thrashing at runtime.

Re: LMAX Disruptor – High Performance Inter-Thread Messaging Library

#20

I am working on a C version of the disruptor ringbuffer it is very simple and I need to verify it so it's probably not ready for others but it might be interesting. Aligning by 128 bytes has dropped latency and stopped false sharing. I have gotten latencies to 50 nanoseconds and up. disruptor-multi.c(SPMC) and disruptor-multi-producer.c (MPSC) https://GitHub.com/samsquire/assembly I am trying to work out how to suppo…

Do you think it’s possible to obtain this performance with Rust? I’ve been down the path you’re on a few times and I love the pursuit. Have built my own over the years about 4 times. Hardware was much slower in those days so my lower barrier was 650ns. Things got worse appreciably as a function of the number of producers I found. Some of my most sleepless nights. The funnest nights.

std::collections::vec_deque is implemented as a growable ring buffer so you might like to start there

https://doc.rust-lang.org/std/collections/vec_deque/index.ht...

Post reply on HN