The competition among high-frequency traders in the system latency has reached the level of less than 10 microseconds, and what is more, the pursuit of time saved by message packets has also reached the nanosecond level. When you wrote/designed the system, you have completed an exciting masterpiece and are ready to show your skills on the battlefield. Have you ever wondered for a while whether the ‘weapons’ you designed can really withstand the hardening of the market? The truth is, most of time, the battlefield would knock you down for the lack of understanding what ‘weapon’ are holding in your hand, and what is it really like. This is not what a trained programmer would like to see at the end.
How to make sure that the system you designed is working functionally and efficiently before it’s rolled out to production? How to confirm that the weapon you made is trustworthy. It's not difficult. What you need is a set of accurate test frameworks and test methods.
The problems the HFT firms that commonly meet on latency measure are:
To calculate latency by inserting log in the code to record Timestamp is quite usual.
This method is feasible in the initial stage of development and can help developers to evaluate the effectiveness on their code, but however, it is not a good way to achieve accurate measurement because of the accuracy of timestamping in OS is open to question, furthermore, if the timestamping information is inserted into the software program, it is bound to share resources with the software to affect the performance of the main program, such as CPU caches.
Timestamping at the OS level is likely to be inaccurate due to various factors, such as system jitter or program bugs or the accuracy of the OS itself. To achieve an accurate and precise measurement, there are several key points that you could follows:
How to build an environment for measuring latency?
Case1 :Measure the time spent on packet IN/OUT in the host.
As shown in Figure 1, the fiber splitter is used to send incoming and outgoing packets to the test subject and the TS analysis host (Timestamp Analyzer). The fiber splitter will not cause delay on its performance, so the packet received by the TS host is nearly same as the testee's IN/OUT packets which TS host could calculate the time difference from the packets it captured.
The TS host must be equipped with a network card that provide the function of timestamping. Generally, programmers usually use the program to record Timestamp, this is not recommended here, because it is distorted and the measure unit is not enough. This structure introduced here can exactly avoiding interference to the object under test.
Case2 : Measurement of NIC Performance from the same structure.
A similar architecture can be derived into the performance test of the network card. The OS under this architecture does almost nothing, at most, it sends the received packets to the destination. The tested network card have to be installed in the tested host.
Case3 : What brand equipment do HFT operators generally use?
NIC[2]: Solarflare, Exablaze ExaNIC, Mellanox
Switch: Cisco N3K, ExaLINK Fusion, Arista7130 L1 Switch
[1] [1] Exablaze is now part of Cisco, the produce name are: Nexus X10,Nexus X25, Nexus X40, Nexus X100.
[2] Some HFT firms use FPGA on latency measurement cause FPGA can perform the best precision, however, it is more higher threshold in FPGA design, that’s why we use NIC in our case in this article.
Copyright © 2020 HyperShark Technologies Corp. All Rights Reserved.