mirror of
https://github.com/bspeice/speice.io
synced 2024-11-14 22:18:10 -05:00
1 line
28 KiB
JavaScript
1 line
28 KiB
JavaScript
|
"use strict";(self.webpackChunkspeice_io=self.webpackChunkspeice_io||[]).push([["1672"],{8204:function(e,n,t){t.r(n),t.d(n,{assets:function(){return h},contentTitle:function(){return o},default:function(){return d},frontMatter:function(){return i},metadata:function(){return a},toc:function(){return c}});var a=t(1403),r=t(5893),s=t(65);let i={slug:"2019/06/high-performance-systems",title:"On building high performance systems",date:new Date("2019-07-01T12:00:00.000Z"),last_updated:{date:new Date("2019-09-21T12:00:00.000Z")},authors:["bspeice"],tags:[]},o=void 0,h={authorsImageUrls:[void 0]},c=[{value:"Language-specific",id:"language-specific",level:2},{value:"Kernel",id:"kernel",level:2},{value:"Hardware",id:"hardware",level:2},{value:"Networks",id:"networks",level:2},{value:"Final Thoughts",id:"final-thoughts",level:2}];function l(e){let n={a:"a",blockquote:"blockquote",code:"code",em:"em",h2:"h2",img:"img",li:"li",p:"p",strong:"strong",ul:"ul",...(0,s.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.p,{children:"Prior to working in the trading industry, my assumption was that High Frequency Trading (HFT) is\nmade up of people who have access to secret techniques mortal developers could only dream of. There\nhad to be some secret art that could only be learned if one had an appropriately tragic backstory."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Kung Fu fight",src:t(7743).Z+"",width:"426",height:"240"})}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:"How I assumed HFT people learn their secret techniques"}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["How else do you explain people working on systems that complete the round trip of market data in to\norders out (a.k.a. tick-to-trade) consistently within\n",(0,r.jsx)(n.a,{href:"https://stackoverflow.com/a/22082528/1454178",children:"750-800 nanoseconds"}),"? In roughly the time it takes a\ncomputer to access\n",(0,r.jsx)(n.a,{href:"https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html",children:"main memory 8 times"}),",\ntrading systems are capable of reading the market data packets, deciding what orders to send, doing\nrisk checks, creating new packets for exchange-specific protocols, and putting those packets on the\nwire."]}),"\n",(0,r.jsx)(n.p,{children:"Having now worked in the trading industry, I can confirm the developers aren't super-human; I've\nmade some simple mistakes at the very least. Instead, what shows up in public discussions is that\nphilosophy, not technique, separates high-performance systems from everything else.\nPerformance-critical systems don't rely on \"this one cool C++ optimization trick\" to make code fast\n(though micro-optimizations have their place); there's a lot more to worry about than just the code\nwritten for the project."}),"\n",(0,r.jsxs)(n.p,{children:["The framework I'd propose is this: ",(0,r.jsx)(n.strong,{children:"If you want to build high-performance systems, focus first on\nreducing performance variance"})," (reducing the gap between the fastest and slowest runs of the same\ncode), ",(0,r.jsx)(n.strong,{children:"and only look at average latency once variance is at an acceptable level"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["Don't get me wrong, I'm a much happier person when things are fast. Computer goes from booting in 20\nseconds down to 10 because I installed a solid-state drive? Awesome. But if every fifth day it takes\na full minute to boot because of corrupted sectors? Not so great. Average speed over the course of a\nweek is the same in each situation, but you're painfully aware of that minute when it happens. When\nit comes to code, the principal is the same: speeding up a function by an average of 10 milliseconds\ndoesn't mean much if there's a 100ms difference between your fastest and slowest runs. When\nperformance matters, you need to respond quickly ",(0,r.jsx)(n.em,{children:"every time"}),", not just in aggregate.\nHigh-performance systems should first optimize for time variance. Once you're consistent at the time\nscale you care abou
|