Messaging Bytes: number two in a series of posts discussing performance with Low Latency Messaging. The series is brought to you by Ultra Messaging – see the entire series at the Messaging Bytes Archive.
Trading applications for financial securities in the capital markets are measured by how fast they can execute trades. And time is money, in the most literal sense.
Even being 1 microsecond (1,000,000/sec) too slow is basically the same as never running the race at all, because the fastest executing trade often causes slower executing trades to be rejected, since the price is no longer available. Win or go home, essentially.
Therefore, for businesses that rely on trading applications to drive revenue, tuning to minimize ‘latency’ — or the length of time a piece of data is delayed during a process – is absolutely essential, a strategic need overriding all others.
In addition to tuning, businesses can undertake major strategic steps to minimize latency, like co-locating application servers on the premises of the exchange itself, or switching to super-fast networks like 10Gb and InfiniBand.
Short of taking those major (and probably expensive) steps, then, here are our Top Five Ways to Minimize Messaging Latency.
(1) Use IPC or RDMA – Move applications to the same host and use IPC to send directly from the memory of one to the memory of another. Or to communicate between boxes, use RDMA to do the same thing over the network.
(2) Avoid Hardware-based Middleware Solutions – Network traffic already runs at the speed of light – taking a detour through another piece of hardware cannot possibly make it go any faster. Ultra Messaging is a direct end-to-end solution that leverages your powerful network and host hardware to deliver the best performance possible in your configuration.
(3) Investigate Garbage Collection in Java and C# – Managed languages offer automatic garbage collection to clean up memory at run time, after it can no longer be referenced. Interrupting productive application work to do garbage collection leads to “jitter”, or latency of unpredictable duration at unpredictable times.
(4) Disable Options That Trade Latency for Convenience or Throughput – Depending on your needs, you might be using configuration options to re-order any out-of-order packets at the receiver, or to batch messages at the sender, or various other things. To minimize latency, use the Ultra Messaging reliable multicast UDP option arrival-order delivery at the receiver, turn off batching at the source, and in general, choose configuration options that prioritize lower latency over other factors.
(5) Disable CPU Power-Saving Features – Saving power is good, except when it isn’t, such as when it costs you precious microseconds of latency that mean your application can’t execute trades.
Of course, we could include the fact that latency is impacted by the speed of light through copper and fiber optics, which is only about 60% of the speed of light in a vacuum. This speed is a constant and therefore predictable for a given distance. For instance, the 6400 km trip from Chicago to London takes about 33 milliseconds. But that would make it a Top Six list, and who wants a Top Six list? Nobody, that’s who.