Hacker News new | ask | show | jobs
by sillysaurus3 4240 days ago
Sub-microsecond transactions seem impossible unless you're physically jacked in to the trading datacenter's network. If you try to transfer a message (like a string buffer) as quickly as possible from program A running on core 0 to program B running on core 5 on your server-grade computer, the best benchmarks I could achieve were "99% of measurements executed in fewer than 150 nanoseconds." And I worked hard on this problem. It seems like maybe you could execute a trade in ~400 nanoseconds at best, if you have a server that's connected with 10GigE directly to a NASDAQ (or whoever) box and you're bypassing how Linux normally does packet handling, but I wouldn't be surprised if the overhead of the other party's server pushes that to at least 1 microsecond in all cases.

But... now that I've examined the facts, I admit what you say may be true. Are HFTs really operating in sub-microsecond time for trades nowadays?

2 comments

The goal is to be faster than the other guy - HFT is a race, thanks to the subpenny rule. So if network latency is 2ms, you still care about making your trades happen in 2,050us vs 2,100us.

Tl;dr even if trades happen in ms, you still care about us.

Yes, you are correct. On an average Linux box to have a single cache line data transfer between the cores under 150ns 99% of the time is about the best that you can get. Especially if you are running stock kernel that eats this 1% and creates huge outliers ;). There is some talk though, about crazily-expensive switches with integrated FPGAs...
These switches aren't really a secret.

And the crazy expensive switch is guaranteed to be the cheap part. Now add the all the ip required to make that fpga smart enough to place orders, and you're talking huge bills in dev hours and third party licensing.

There are HFT trading systems implemented in FPGAs. They're written in Verilog. Here's one system:

http://www.bittware.com/fpga-dsp-applications/applications-s...

Want to work in that field? Know VHDL/Verilog, Linux, networking down to the wire level?

https://www.linkedin.com/jobs2/view/1821955

Light moves at 1 ft per nanosecond... I sure hope you're close to the NASDAQ data center :)
It's 1ft/ns in a vacuum, but my understanding is that it's closer to 0.5ft/ns in a wire, so what you say is doubly true. But I think HFTs are running on servers close to the NASDAQ datacenter, and that people pay buckets of money for such privileges.
Pretty sure NASDAQ rents servers directly on site for serious dough, so distance is not that much of an issue.
Yes and No. Nearly every electronic exchange now offers co-location services (including NASDAQ).

The "serious dough" part is a little harder to quantify. I've not looked into NASDAQ specifically but server colocation is usually on the order of a couple of thousand dollars a month. This is a drop in the bucket compared to the real costs of a professional trading outfit (namely employees and margin/risk costs).

Anecdotally, it's also almost exactly what I paid for a tier 1 co-located server at my first job in a startup during the first dotcom boom.

Wire? It's infiniband and other bufferless network protocols over fiber.
Fiber is still only about 66% of c.