OnixS BME SENAF Handler C++ library  2.2.1
API documentation
Low Latency Best Practices

Given topic uncovers how to configure Handler in order to achieve maximal performance characteristics and lowest processing latency.

Configuring Logging Subsystem

Under normal conditions a Handler logs important events and market data transmitted by SENAF into a log file. As far as logging entries represent textual information, binary data like incoming messages are encoded using base64-encoding before stored in log. That adds extra time into processing cycle. Finally, if Logger implementation stores its data into a file, that may be a relatively slow operation.

To eliminate slowdowns caused by flushing data to filesystem and/or extra encoding operations, logging can be disabled by setting OnixS::Senaf::MarketData::HandlerSettings::advancedLogOptions to the OnixS::Senaf::MarketData::AdvancedLogOptions::LogNothing. In such case log events are not constructed by the Handler and nothing is logged at all.

Turning Up Working Threads

Market data processing is done asynchronously by using working threads. Under normal conditions, threads may be executed on any processor available in the system. That may have negative influence onto overall performance due to unnecessary thread context switching.

To avoid switching threads between processors, the Handler as a manager of working threads, allows to establish processor affinity for each working thread:

HandlerSettings handlerSettings;
// Scheduling the Handler to use concrete processor's core.
handlerSettings.processingThreadAffinity.insert(1);