libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
isimud::exchanges::common::exchange_connection< ClientCxn, EchgCxn > Class Template Referencefinal

A class that implements bi-directional client-to-exchange message flow. More...

#include <exchange_connection.hpp>

Classes

class  flow
 

Public Types

using client_link_t = ClientCxn
 A single connection to a client. More...
 
using exchg_link_t = EchgCxn
 A single connection to a specific exchange. More...
 
using exchg_links_t = exchg_link_t
 A pool of connections to an exchange. More...
 
using client_msg_details_t = typename client_link_t::proc_rules_t::src_msg_details_t
 A type containing the details of the exchange-side messages that will be sent and received to and from the exchange. More...
 
using exchange_msg_details_t = typename exchg_links_t::msg_details_t
 A type containing the details of the client-side messages that will be sent and received to and from the exchange. More...
 
using exchg_to_client_proc_rules_t = typename exchg_links_t::proc_rules_t
 
using socket_t = typename client_link_t::socket_t
 
using thread_api_traits = jmmcg::ppd::api_threading_traits< jmmcg::ppd::platform_api, jmmcg::ppd::heavyweight_threading >
 

Public Member Functions

template<class LatencyTimestamps >
 exchange_connection (typename client_link_t::ctor_args const &client_cxn_details, typename exchg_links_t::ctor_args const &exchange_cxn_details, typename socket_t::socket_priority to_exchg_priority, typename socket_t::socket_priority to_client_priority, exchg_to_client_proc_rules_t const &proc_rules, LatencyTimestamps &timestamps)
 
 ~exchange_connection () noexcept(false)
 
bool is_logged_on () const noexcept(true)
 
std::sig_atomic_t signal_status () const noexcept(true)
 
std::string to_string () const noexcept(false)
 

Detailed Description

template<class ClientCxn, class EchgCxn>
class isimud::exchanges::common::exchange_connection< ClientCxn, EchgCxn >

A class that implements bi-directional client-to-exchange message flow.

This class is implemented with two threads: one handles the client-to-exchange messages, the other that handles the exchange-to-client messages. This implies that for optimal performance two cores are required per instance of this class. i.e. optimally, a computer can run P/2 instances of this class, where P is the number of available cores. Ideally the computer should have at least two physical processors and two physical PCI buses. Each processor should be connected to only one PCI bus with processor zero connected to all of the peripherals (SATA, etc buses). At a minimum taskset, numactl (e.g. "numactl --preferred=1 --cpunodebind=1") or CPU groups (cgroups) should be used to isolate the OS to processor zero (including suitable interrupts), and the process that instantiates this class should be isolated to all processors excluding zero. Onto the PCI buses connected to those processors the network cards should be attached. The network cards should be DMA-capable at the minimum. Consideration should be given to using Solarflare (or equivalent) network cards and OpenOnload, with suitable configuration. Co-location should be a consideration.

Todo:

The client-to-exchange link should run at high priority.

Have two templates: one for creating messages to send to the exchange, the other for creating messages to send back to the client, to improve performance.

Definition at line 97 of file exchange_connection.hpp.

Member Typedef Documentation

◆ client_link_t

template<class ClientCxn , class EchgCxn >
using isimud::exchanges::common::exchange_connection< ClientCxn, EchgCxn >::client_link_t = ClientCxn

A single connection to a client.

Definition at line 117 of file exchange_connection.hpp.

◆ client_msg_details_t

template<class ClientCxn , class EchgCxn >
using isimud::exchanges::common::exchange_connection< ClientCxn, EchgCxn >::client_msg_details_t = typename client_link_t::proc_rules_t::src_msg_details_t

A type containing the details of the exchange-side messages that will be sent and received to and from the exchange.

Definition at line 127 of file exchange_connection.hpp.

◆ exchange_msg_details_t

template<class ClientCxn , class EchgCxn >
using isimud::exchanges::common::exchange_connection< ClientCxn, EchgCxn >::exchange_msg_details_t = typename exchg_links_t::msg_details_t

A type containing the details of the client-side messages that will be sent and received to and from the exchange.

Definition at line 129 of file exchange_connection.hpp.

◆ exchg_link_t

template<class ClientCxn , class EchgCxn >
using isimud::exchanges::common::exchange_connection< ClientCxn, EchgCxn >::exchg_link_t = EchgCxn

A single connection to a specific exchange.

Definition at line 119 of file exchange_connection.hpp.

◆ exchg_links_t

template<class ClientCxn , class EchgCxn >
using isimud::exchanges::common::exchange_connection< ClientCxn, EchgCxn >::exchg_links_t = exchg_link_t

A pool of connections to an exchange.

Due to message-throttling per connection, one may wish to have multiple connections to a server (e.g. an exchange).

Todo:
Implement some sort of pool & priority_queue with heuristic to select the next connection to use.

Definition at line 125 of file exchange_connection.hpp.

◆ exchg_to_client_proc_rules_t

template<class ClientCxn , class EchgCxn >
using isimud::exchanges::common::exchange_connection< ClientCxn, EchgCxn >::exchg_to_client_proc_rules_t = typename exchg_links_t::proc_rules_t

Definition at line 130 of file exchange_connection.hpp.

◆ socket_t

template<class ClientCxn , class EchgCxn >
using isimud::exchanges::common::exchange_connection< ClientCxn, EchgCxn >::socket_t = typename client_link_t::socket_t

Definition at line 131 of file exchange_connection.hpp.

◆ thread_api_traits

template<class ClientCxn , class EchgCxn >
using isimud::exchanges::common::exchange_connection< ClientCxn, EchgCxn >::thread_api_traits = jmmcg::ppd::api_threading_traits<jmmcg::ppd::platform_api, jmmcg::ppd::heavyweight_threading>

Definition at line 132 of file exchange_connection.hpp.

Constructor & Destructor Documentation

◆ exchange_connection()

template<class ClientCxn , class ServerCxn >
template<class LatencyTimestamps >
isimud::exchanges::common::exchange_connection< ClientCxn, ServerCxn >::exchange_connection ( typename client_link_t::ctor_args const &  client_cxn_details,
typename exchg_links_t::ctor_args const &  exchange_cxn_details,
typename socket_t::socket_priority  to_exchg_priority,
typename socket_t::socket_priority  to_client_priority,
exchg_to_client_proc_rules_t const &  proc_rules,
LatencyTimestamps &  timestamps 
)
inline

Definition at line 148 of file exchange_connection_impl.hpp.

◆ ~exchange_connection()

template<class ClientCxn , class ServerCxn >
isimud::exchanges::common::exchange_connection< ClientCxn, ServerCxn >::~exchange_connection ( )
inlinenoexcept

Definition at line 166 of file exchange_connection_impl.hpp.

Member Function Documentation

◆ is_logged_on()

template<class ClientCxn , class EchgCxn >
bool isimud::exchanges::common::exchange_connection< ClientCxn, EchgCxn >::is_logged_on ( ) const
inlinenoexcept

Definition at line 138 of file exchange_connection.hpp.

◆ signal_status()

template<class ClientCxn , class ServerCxn >
std::sig_atomic_t isimud::exchanges::common::exchange_connection< ClientCxn, ServerCxn >::signal_status ( ) const
inlinenoexcept

Definition at line 171 of file exchange_connection_impl.hpp.

◆ to_string()

template<class ClientCxn , class ServerCxn >
std::string isimud::exchanges::common::exchange_connection< ClientCxn, ServerCxn >::to_string ( ) const
inlinenoexcept

Definition at line 176 of file exchange_connection_impl.hpp.


The documentation for this class was generated from the following files: