|Threading Model||Table of Content||Connectivity Troubleshooting|
|Low Latency Best Practices|
This section explains how to configure Handler in order to achieve maximal performance characteristics and lowest processing latency.
Under normal conditions Handler logs important events and market data transmitted by iMpact Multicast Price Feed into log file. As far as log file uses text-based format, binary data like incoming market data is base64-encoded before stored in log. That adds extra time into processing cycle. Finally, logging is file-based and thus is relatively slow.
To eliminate slowdowns caused by flushing data to filesystem and/or extra encoding operations, logging subsystem should be disabled by setting LogLevel parameter to Fatal value and AdvancedLogOptions parameter to LogNothing.
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, Handler allows to establish processor affinity for each working thread:
HandlerSettings handlerSettings = new HandlerSettings(); handlerSettings.AddProcessingThreadAffinity(1);
Under normal conditions, Handler effectively utilizes internal structures used to keep incoming market data. Packets and ICE iMpact messages are re-used once contained data is processed by Handler. Therefore, no data is allocated during real-time market data processing.
However, data may be copied within callbacks Handler invokes as listeners to various market data events. Thus, when book is copied, that invokes memory allocation and thus has negative effect onto performance and latency. To improve the results, copying should be minimized or strategies with preallocation should be used.