C / C ++ technologies related to sending data over networks very quickly

In terms of low latency (I think of financial exchanges / co-location - people who are interested in microseconds), what are the options for sending packages from a C ++ program to two Unix computers?

I have heard about network core network bypasses, but does this mean that you are programming against some kind of API for the card? I believe this would be a faster option compared to using standard UNIX sockets for Berkels?

I would really appreciate any input, especially from the people who are involved in this area.

EDITED milliseconds to microseconds

EDITED I really hope to get answers based more on C / C ++ rather than network technology. It was intended as a programming issue.

+4
source share
5 answers

UDP sockets are fast, low-latency and reliable enough when both machines are on the same LAN. TCP is much slower than UDP, but when both machines are not on the same LAN, UDP is not reliable.

+1
source

Software profiling will stop obvious problems with your program. However, when you talk about network performance, network latency is likely to be the biggest bottleneck. If you use TCP, then you want to do something that avoids congestion and loss on your network to prevent retransmissions. There are several things to do to handle:

  • Use a network with guaranteed bandwidth and reliability.
  • Set the TCP parameters correctly for maximum use without loss.
  • Use error correction in your data transfer to fix a small loss that you might encounter.

Or you may not use TCP at all. But if reliability is required, you end up implementing most of what is already in TCP.

But you can use existing projects that have already thought through many of these issues. The UDT project is the one I know about that seems to be gaining momentum.

+1
source

At some point, I was working with a packet sending driver that was loaded into the Windows kernel. Using this driver, it was possible to generate a packet stream 10-15 times stronger (I donโ€™t remember the exact number) than from an application using a socket layer.

The advantage is simple: a send request arrives directly from the kernel and bypasses several layers of software: sockets, a protocol (even processing a UDP packet protocol requires simple protocol processing), a context switch, etc.

+1
source

Typically, a decrease in latency occurs due to a decrease in reliability. Compare, for example, the often-called fastpath option for ADSL . Reduced latency due to shorter packet transmission times is associated with increased error susceptibility. Similar migt technologies exist for a large number of network media. It is very dependent on the hardware technology used. Your question assumes that you mean Ethernet, but it is unclear whether this connection is only Ethernet or something else (ATM, ADSL, ...) and whether other network technology can be used. It also depends very much on geographic distances.

EDIT:
I got a little carried away by the hardware aspects of this issue. To provide at least one aspect that is tangible at the application design level: see zero-copy network operations such as sendfile (2) . They can be used to eliminate one possible cause of the delay, although only if the source data comes from some other source than the applicationโ€™s memory.

+1
source

As my day job, I work on a certain exchange. Below is my own opinion on the software solutions that we provide specifically for such data transmission with low bandwidth and high bandwidth. It should in no way be taken as a marketing step (please, I Dev). This is just to give what are the main components of the software stack in this solution for such fast data (data can be stocks / data of the trading market or any data in general): -

1] Physical layer โ€” a network interface card for an Ethernet network based on TCP-UDP / IP or a very high speed / high bandwidth interface called the Infiniband host channel adapter. In the case of a software stack, IP / Ethernet is part of the OS. For Infiniband, the card manufacturer (Intel, Mellanox) provides its drivers, firmware, and API library against which it is necessary to implement a socket code (Even infiniband uses its own "socket" protocol for network communication between two nodes.

2] The next layer above the physical layer is Middleware , which basically abstracts the lower network protocols nittigritties, provides some interface for input / output of data from the physical layer to the application layer. This layer also provides some assurance of network data quality (using tCP)

3] The last layer is the application that we provide on top of middleware. Anyone who receives 1] and 2] from us can develop an application with low latency / high bandwidth network data for stock trading, algorithmic trading types of applications using a choice of programming language interfaces - C, C ++, Java, C # .

Basically, the client is how you can develop your own application in C, C ++ using the APIs that we provide, which will take care of interacting with NIC or HCA (that is, with a real physical network interface) for fast and fast data transfer quickly.

We have a comprehensive solution that meets the various profiles of quality and waiting time required by our customers. Some require Microseconds latency, but they require high quality data / very small errors; Some may suffer several errors, but they need an avalanche of nano seconds, some need a delay in microseconds, there are no permissible errors, ...

If you need or any interest in this kind of solution, ping me offline in my contacts mentioned here in SO.

0
source

All Articles