News for hackers. Stuff that matters.
Re:C++ patterns for low-latency applications including high-... by zxcvbn4038 on Monday July 08, 2024 @08:13PM (#40911224)
When I did low latency everyone was offloading TCP to dedicated hardware.

They would shut down every single process on the server and bind the trading trading app to the CPUs during trading hours to ensure nothing interrupted.

Electrons travel slower than light so they would rent server space at the exchange so they had direct access to the exchange network and didn't have to transverse miles of cables to send their orders.

They would multicast their traffic and there were separate systems to receive the multicast, log packets, and write orders to to databases. There were redundant trading servers that would monitor the multicast traffic so that if they had to take over they would know all of the open positions and orders.

They did all of their testing against simulators - never against live data or even the exchange test systems. They had a petabyte of exchange data they could play back to verify their code worked and to see if tweaks to the algorithm yielding better or worse trading decisions over time.

A solid understanding of the underlying hardware was required, you would make sure network interfaces were arranged in a way they wouldn't cause contention on the PCI bus. You usually had separate interfaces for market data and orders.

All changes were done after exchange hours once trades had been submitted to the back office. The IT department was responsible for reimbursing traders for any losses caused by IT activity - there were shady traders who would look for IT problems and bank them up so they could blame a bad trade on them at some future time.

Re:C++ patterns for low-latency applications including high-... by gohwell on Monday July 08, 2024 @08:21PM (#40911284)
I’ve worked at a few firms and never heard of an IT budget for f-ups. Sounds like a toxic work environment.
Re:C++ patterns for low-latency applications including high-... by hawk_ on Tuesday July 09, 2024 @03:06AM (#40913278)
Depends on how it's set up. You take a chunk of profits as well if things go well.
Re:C++ patterns for low-latency applications including high-... by davidmr on Tuesday July 09, 2024 @05:03AM (#40913938)
Same. That sounds like a way to make that relationship between front office and back office as toxic and unproductive as possible.
Re:C++ patterns for low-latency applications including high-... by resonious on Wednesday July 10, 2024 @02:04AM (#40924129)
It's just business, no? Would you rather trade with a service that's liable for their mistakes or one that isn't?
Re:C++ patterns for low-latency applications including high-... by ra0x3 on Monday July 08, 2024 @08:58PM (#40911526)
A great insightful comment, thank you!
Re:C++ patterns for low-latency applications including high-... by rramadass on Monday July 08, 2024 @11:22PM (#40912257)
Any good books/resources you can recommend to learn about the above architectures/techniques?
Re:C++ patterns for low-latency applications including high-... by neomantra on Tuesday July 09, 2024 @09:30AM (#40915914)
Some years ago I wrote a gist about HFT/HPC systems patterns (versus OPs C++ patterns) applied to dockerized Redis. Might be dated, but touches on core isolation/pinning, numa/cgroups, kernel bypass, with some links to go deeper. Nowadays I do it with Kubernetes and Nomad facilities, but same basic ideas:

https://gist.github.com/neomantra/3c9b89887d19be6fa5708bf401...

Re:C++ patterns for low-latency applications including high-... by rramadass on Tuesday July 09, 2024 @01:23PM (#40918600)
Nice; reminds me of the Redhat Performance Tuning and Real Time Low Latency Optimization guides.
Re:C++ patterns for low-latency applications including high-... by crabmusket on Tuesday July 09, 2024 @09:35AM (#40915975)
A few episodes of Signals and Threads, a podcast from Jane Street, go into parts of it.
Re:C++ patterns for low-latency applications including high-... by rramadass on Tuesday July 09, 2024 @01:25PM (#40918637)
Thank You.
Re:C++ patterns for low-latency applications including high-... by shaklee3 on Tuesday July 09, 2024 @12:50AM (#40912626)
You don't need to shut down processes on the server. All you have to do is isolate CPU cores and move your workloads onto those cores. That's been a common practice in low latency networking for decades.
Re:C++ patterns for low-latency applications including high-... by bluGill on Tuesday July 09, 2024 @02:09AM (#40912955)
I'm not in HFT, but I wouldn't expect that to be enough.

Not only do you want to isolate cores, you want to isolate any shared cache between cores. You do not want your critical data ejected from the cache because a different core sharing the cache has decided it needs that cache. Which of course starts with knowing exactly what CPU you are using since different ones have different cache layouts.

You also don't want those other cores using up precious main memory or IO bandwidth at the moment you need it.

Re:C++ patterns for low-latency applications including high-... by worstspotgain on Tuesday July 09, 2024 @02:18AM (#40912995)
Just to add to your good points: since there's always a faster cache for your working set to not fit in, you can use memory streaming instructions to reduce cache pollution. Depending on the algorithm, increasing cache hit rates can give ridiculous speed-ups.
Re:C++ patterns for low-latency applications including high-... by shaklee3 on Tuesday July 09, 2024 @09:23AM (#40915831)
Correct. I was just pointing out to OP that moving processes is not worthwhile and isolation is how you'd do it