Skip to content

Expose RxBufferSize/TxBufferSize config properties, wire to ws-streaming - #15

Open
denise-opendaq wants to merge 1 commit into
release/4.0from
configurable-buffer-sizes
Open

Expose RxBufferSize/TxBufferSize config properties, wire to ws-streaming#15
denise-opendaq wants to merge 1 commit into
release/4.0from
configurable-buffer-sizes

Conversation

@denise-opendaq

Copy link
Copy Markdown

ws-streaming's wss::detail::peer previously always allocated its compiled-in default buffer sizes (32 MiB tx, 1 MiB rx) for every connection, with no way to override them from openDAQ - see the companion change on ws-streaming's configurable-buffer-sizes branch, which adds rx_buffer_size/tx_buffer_size parameters to connection, client, and server.

Add RxBufferSize/TxBufferSize Int properties to both WsStreamingServer::createDefaultConfig() and
WsStreaming::createDefaultConfig(), and thread them through to the wss::server/wss::client construction call in each. Also wire config through to WsStreaming's constructor and onCreateStreaming(), which previously received the config parameter but silently discarded it.

Defaults are chosen per role rather than reusing the old shared 32 MiB value: a server's traffic is transmit-heavy (streaming samples out to clients) so it gets the larger TxBufferSize (4 MiB) and smaller RxBufferSize (1 MiB); a client's traffic is receive-heavy (mostly receiving sample data, sending only small subscribe/RPC requests) so it gets the opposite - RxBufferSize 4 MiB, TxBufferSize 1 MiB.

Verified with a custom LD_PRELOAD allocation tracer against quick_start_empty connecting to quick_start_simulator over daq.lt://: total bytes allocated during the addDevice() call dropped from 44.7 MB to 15.5 MB, with the two buffer allocations now showing up at exactly 4194304 and 1048576 bytes as expected, and the connection still completing successfully (all signals available/subscribed as before).

ws-streaming's wss::detail::peer previously always allocated its
compiled-in default buffer sizes (32 MiB tx, 1 MiB rx) for every
connection, with no way to override them from openDAQ - see the
companion change on ws-streaming's configurable-buffer-sizes branch,
which adds rx_buffer_size/tx_buffer_size parameters to connection,
client, and server.

Add RxBufferSize/TxBufferSize Int properties to both
WsStreamingServer::createDefaultConfig() and
WsStreaming::createDefaultConfig(), and thread them through to the
wss::server/wss::client construction call in each. Also wire config
through to WsStreaming's constructor and onCreateStreaming(), which
previously received the config parameter but silently discarded it.

Defaults are chosen per role rather than reusing the old shared 32 MiB
value: a server's traffic is transmit-heavy (streaming samples out to
clients) so it gets the larger TxBufferSize (4 MiB) and smaller
RxBufferSize (1 MiB); a client's traffic is receive-heavy (mostly
receiving sample data, sending only small subscribe/RPC requests) so
it gets the opposite - RxBufferSize 4 MiB, TxBufferSize 1 MiB.

Verified with a custom LD_PRELOAD allocation tracer against
quick_start_empty connecting to quick_start_simulator over daq.lt://:
total bytes allocated during the addDevice() call dropped from 44.7 MB
to 15.5 MB, with the two buffer allocations now showing up at exactly
4194304 and 1048576 bytes as expected, and the connection still
completing successfully (all signals available/subscribed as before).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant