Moniker based streaming for NI Drivers - ni/grpc-device GitHub Wiki

Moniker based streaming provides support for streaming data to and from grpc-device server. This type of streaming helps achieve higher throughput compared to traditional read/write loops using memory optimizations on the server side.

Supported APIs

As of 2.10.0 release of grpc-device some of the APIs for NI DAQMx and FPGA support moniker based streaming functionality. Most of the Read and Write APIs support moniker based streaming. All moniker based streaming APIs have same name as corresponding C/gRPC API with Begin prefix.

Here are a few examples of moniker based streaming APIs:

DAQmx:

  • BeginReadBinaryU16
  • BeginWriteAnalogF64
  • BeginReadPowerBinaryI16
  • ...

FPGA:

  • BeginReadArrayI64
  • BeginWriteArrayI8
  • BeginReadI32
  • ...

To identify APIs that support this type of streaming examine .proto file for corresponding driver and look for APIs with Begin prefix.

Types of streaming:

Moniker based streaming supports two types of streaming.

Streaming using gRPC streams

data_moniker.proto exposes following APIs that use gRPC streams for streaming the data.

  • StreamRead
  • StreamWrite
  • StreamReadWrite

Streaming using sideband mechanism

data_moniker.proto exposes BeginSidebandStream API to stream data using custom sideband streaming mechanism. This mechanism helps achieve even higher throughput by streaming data over raw sockets between server and client.

[!NOTE] Sideband mechanism for streaming uses raw unsecured sockets for streaming data between client and server. This is done in order to achieve higher throughput, but also exposes data to potential intruders on the network. For this reason sideband streaming is OFF by default. Make sure you enable and use sideband streaming only under limited trusted network setup.

Limitations

As of now Write type of streaming APIs do not return any response.

Enabling streaming functionality

As of 2.10.0 release, both types of moniker based streaming functionality is behind a feature toggle. To enable moniker based streaming add following lines to server_config.json.

"feature_toggles": {
  "moniker_streaming": true
}

To enable sideband based streaming, add following lines to server_config.json.

"feature_toggles": {
  "moniker_streaming": true,
  "moniker_streaming_sideband_support": true
}

Examples