On Linux, the FIX Engine can probe the timestamp of the received data and provide it to the user along with the data. This can be useful to monitor the TCP/IP stack performance. The timestamp of the received data is delivered via the OnixS::FIX::ISessionListener::onReceivedBytes() callback:
Depending on the OnixS::FIX::Session configuration, hardware capabilities, and the operation system, OnixS::FIX::ReceivedDataTimestamp::Source can have the following values:
None
: no timestamp is taken;Software
: a timestamp provided by the OS kernel / user-level network stack is taken;Hardware
: a timestamp provided by the network card is taken;If accessible, the network interface card timestamp is used (ReceivedDataTimestamp::Source::Hardware
); otherwise, the timestamp supplied by the OS kernel or the user-level network stack is used (ReceivedDataTimestamp::Source::Software
).
To configure the session to take the timestamp, the OnixS::FIX::EngineSettings::enableRxTimestamp() or OnixS::FIX::Session::enableRxTimestamp() must be set:
To configure the session to take the Hardware timestamp, the corresponding configuration should be applied on the given network interface card. One can do it using the OnixS::Sockets::Nic::setHardwareTimestamp() helper method:
If the OnixS OnixS::FIX::TCPDirect::Stack is used, the timestamping must be enabled on the stack level:
If the Solarflare OpenOnload is used, The EF_RX_TIMESTAMPING
environment variable must be set to 1
:
To compare hardware-based timestamps with the host time, it is necessary to synchronize the network interface card clock with the host clock, as described in IEEE 1588-2008.
For the Solarflare cards, the sfptpd
utility can be used to perform this synchronization.
50-100
nanoseconds to the resulting latency.ReceivedDataTimestamp::Source::None
, and the timestamp value will contain the previous last timestamp value if it exists.This article describes how to detect TCP congestion using described functional.