The default implementation of the Feed Engine is based on the standard socket API. However, various network card manufactures offer alternatives to the standard socket API to manipulate network data. For example, the Solarflare offers ef_vi SDK to send and receive multicast packets bypassing the kernel and avoiding copying data from internal buffers to user space. The Solarflare ef_vi SDK is designed for high-performance networking for trading applications.
Starting from version 5.1 of the SDK, the standard distribution includes an implementation of the Feed Engine concept based on the Solarflare ef_vi SDK. The functionality is encapsulated into the OnixS::CME::ConflatedUDP::SolarflareFeedEngine class. The design of the class is similar to the OnixS::CME::ConflatedUDP::SocketFeedEngine class. The only difference is the parameters affecting the behaviour of the new Feed Engine.
- The Solarflare ef_vi SDK is available for Linux platforms only and solely for Solarflare network cards. To simplify the development process for users, the SDK exposes the OnixS::CME::ConflatedUDP::SolarflareFeedEngine and related classes for all platforms. However, instance creation will fail at runtime on a platform where the corresponding functionality is not supported. Similarly, any attempt to use the ef_vi based feed engine with a non-Solarflare network interface will lead to an error.
Configuring the New Feed Engine
The Solarflare ef_vi SDK uses the concept of virtual interfaces to receive network data. The SDK follows this concept and exposes parameters related to the given entities. All parameters are gathered into the OnixS::CME::ConflatedUDP::SolarflareFeedEngineSettings class:
- The OnixS::CME::ConflatedUDP::SolarflareFeedEngineSettings::receiveRingSize parameter defines the number of buffers in a virtual interface receive ring. Buffers from the receive ring are filled with network packets (a single buffer is used for a single packet). The feed engine checks which buffers are filled with incoming data and delivers those buffers to the handlers for further processing. The receive ring must be large enough to accommodate incoming data during market data bursts.
- The OnixS::CME::ConflatedUDP::SolarflareFeedEngineSettings::cacheSize parameter sets the size of a pool of buffers used to receive and manipulate incoming data. When the buffers are put into the receive ring and filled with incoming data, the feed engine delivers the buffers to the handlers for further processing. Thus, the buffers filled with the data are kept busy until the received data is processed by handlers. In case of rapid transmission, buffers may be allocated by the feed engine quicker than they are processed by the handlers and released back to pool. Therefore, the pool must be large enough to avoid data loss caused by an empty pool and receive ring.
The Sample Application
The SDK evaluation distribution includes fast-start reference implementation source code samples - including a Benchmarking sample. This sample has been updated to include the Feed Engine based on the Solarflare ef_vi SDK in the available predefined Feed Engine implementations. See the sample source code to get familiar with the concept and use of the feed engine implementation based on the Solarflare ef_vi SDK.