Live data from Hacker News

We chose Java for our high-frequency trading application

medium.com

1–10 of 287 posts

Re: We chose Java for our high-frequency trading application

#2
I've used Java and C++ in a few low latency applications and I do prefer Java in certain scenarios. The whole ecosystem around Java makes rapid development easier meaning we could make safe changes quicker which is a big benefit in trading systems where you need to react to unpredictable market conditions.

The article focuses quite heavily on Zing vs Hotspot but it'd be interesting to see an analysis of a variety of the standard JVMs GC methods (namely Shenandoah).

For anyone interested in low latency Java I'd recommend watching some of Martin Thompson's talks on building LMAX and his blog Mechanical Sympathy is a great start too.

Re: We chose Java for our high-frequency trading application

#3
post #2

I've used Java and C++ in a few low latency applications and I do prefer Java in certain scenarios. The whole ecosystem around Java makes rapid development easier meaning we could make safe changes quicker which is a big benefit in trading systems where you need to react to unpredictable market conditions. The article focuses quite heavily on Zing vs Hotspot but it'd be interesting to see an analysis of a variety of…

LMAX Disruptor is a really powerful abstraction if you are trying to build something with consistently-low latency. I've been using a variant in .NET Core for purposes of processing UI events.

Re: We chose Java for our high-frequency trading application

#4
post #2

I've used Java and C++ in a few low latency applications and I do prefer Java in certain scenarios. The whole ecosystem around Java makes rapid development easier meaning we could make safe changes quicker which is a big benefit in trading systems where you need to react to unpredictable market conditions. The article focuses quite heavily on Zing vs Hotspot but it'd be interesting to see an analysis of a variety of…

ZGC is at 1-2ms max pause time in JDK 16 and is expected to reach <1ms max pause time within a year.

Re: We chose Java for our high-frequency trading application

#5
I think I actually saw these folks present at JavaOne a couple years ago? Either that or there's more than one shop branding itself as "HFT" that uses Java.

I worked in the industry and it's always a little funny to see who calls themselves HFTs vs quants.

Basically, there's a bit of a spectrum of fast vs smart. In general it's hard to do incredibly smart stuff fast enough to compete in the "speed-critical" bucket of trades and vice-versa there's barely any point in being ultra-fast in the "non-speed-critical" bucket because your alphas last for minutes to hours.

Just from this read, I feel like these folks are just a hair to the right of "fast" in the [fast]---------[smart] continuum. I mostly make this appraisal based on these paragraphs:

>To gain those few crucial microseconds, most players invest in expensive hardware: pools of servers with overclocked liquid-cooled CPUs (in 2020 you can buy a server with 56 cores at 5.6 GHz and 1 TB RAM), collocation in major exchange datacentres, high-end nanosecond network switches, dedicated sub-oceanic lines (Hibernian Express is a major provider), even microwave networks. >It’s common to see highly customised Linux kernels with OS bypass so that the data “jumps” directly from the network card to the application, IPC (Interprocess communication) and even FPGAs (programmable single-purpose chips).

That's nice but that's where the cutting edge of the speed game was in 2007ish. Everything mentioned here is table stakes at this point (colocation, dedicated fiber, expensive switches, bypassing the kernel in network code, etc). The fact that "even FPGAs" is listed as "even" is the biggest thing I focus on. FPGA's and/or custom silicon is where the speed game is right now. Similarly, "even microwave networks" is also table stakes at this point (you can get on nasdaq's wireless[0] just by paying).

This is the kind of game where capex for technology is dwarfed by the margin you're slinging around every day in trading, so you see some pretty absurd hardware justified.

[0] http://n.nasdaq.com/WirelessConnectivitySuite

Edit: Also shout-out to a different comment in this thread mentioning ISLD, a story I considered telling as well: https://news.ycombinator.com/item?id=24896603

Re: We chose Java for our high-frequency trading application

#7
There's a major historically-contingent component to this, too. The Island ECN, later absorbed into NASDAQ's ECN, originally ran its matching engine as one of these low-latency Java processes, writing everything using explicit object pools to avoid doing any GC on the critical path, as this was long before Zing was around.

This was a pretty reasonable choice at the time, as this was long before C++11 was around, and Java just offered a lot of advantages for developer ergonomics.

A natural consequence of this is that a number of HFT shops that were seeded by ex-ISLD devs just fell into using something like the ISLD tech stack, which at least at first involved a lot of GC-free Java.

Re: We chose Java for our high-frequency trading application

#8
Does anyone know if C#/dotnet is used in HFT to any extent? I'd imagine proper support for user-defined unboxed types (structs) and non-hacky methods for manual memory management (unsafe) could give it major advantage over Java with much of the QoL improvements java has over C++.

Re: We chose Java for our high-frequency trading application

#9
I'd be curious about knowing the technical details, as the article is pretty much an advertisement. Example: the vast majority of the GC section is about GC in general; only a small part is specific about C4, and with little details.

Specifically, the C4 looks very interesting, although I'm a bit perplexed because, if it was universally good as it's written, they would have essentially solved one of the major problems not just for Java, but for a large amount of languages.

Re: We chose Java for our high-frequency trading application

#10
post #2

I've used Java and C++ in a few low latency applications and I do prefer Java in certain scenarios. The whole ecosystem around Java makes rapid development easier meaning we could make safe changes quicker which is a big benefit in trading systems where you need to react to unpredictable market conditions. The article focuses quite heavily on Zing vs Hotspot but it'd be interesting to see an analysis of a variety of…

>The article focuses quite heavily on Zing vs Hotspot but it'd be interesting to see an analysis of a variety of the standard JVMs GC methods (namely Shenandoah).

Also, ZGC, which is considered production-ready in JDK 15.

Post reply on HN