-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SILKIT-1608: disable nagle algorithm by default #181
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ running on 'localhost' listening on port 8500. These values can be changed via t | |
Middleware: | ||
RegistryUri: silkit://localhost:8500 | ||
ConnectAttempts: 1 | ||
TcpNoDelay: false | ||
TcpNoDelay: true | ||
TcpQuickAck: false | ||
TcpSendBufferSize: 1024 | ||
TcpReceiveBufferSize: 1024 | ||
|
@@ -57,7 +57,7 @@ running on 'localhost' listening on port 8500. These values can be changed via t | |
By default, only a single connect is attempted. | ||
|
||
* - TcpNoDelay | ||
- Enable the TCP_NODELAY flag on TCP sockets. This disables Nagle's algorithm. | ||
- Disable the TCP_NODELAY flag on TCP sockets. This enables Nagle's algorithm. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The old formulation is correct! auto MakeAsioSocketOptionsFromConfiguration(const SilKit::Config::ParticipantConfiguration& participantConfiguration) -> SilKit::Core::AsioSocketOptions
{
SilKit::Core::AsioSocketOptions socketOptions{};
// ...
socketOptions.tcp.noDelay = participantConfiguration.middleware.tcpNoDelay;
// ...
} if (socketOptions.tcp.noDelay)
{
socket.set_option(asio::ip::tcp::no_delay{true}, errorCode);
// ...
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! |
||
|
||
* - TcpQuickAck | ||
- Enable the TCP_QUICKACK flag on TCP sockets (Linux only). Disables delayed | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,21 @@ | ||||||||||
.. include:: /substitutions.rst | ||||||||||
|
||||||||||
Performance | ||||||||||
========= | ||||||||||
|
||||||||||
The following sections provide support for improving the performance of |ProductName|. | ||||||||||
|
||||||||||
Configuration of TCP Stack (Kernel) | ||||||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||
Comment on lines
+8
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
The TCP stack of the kernel can be configured via the participant configuration file, more precisely the :doc:`middleware<../configuration/middleware-configuration>` options. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
This configuration needs to be done carefully. In particular, Nagle's algorithm (``TcpNoDelay``) and delayed acknowledgements (``TcpQuickAck``) are known to interact badly. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I would add which configuration values interact badly. It's also only a 'bad' interaction, if latency is a major concern - which is the case for us, but, e.g., not for bulk transfers (downloads). Nagle and delayed ACKs exist to use bandwidth efficiently, i.e., to use the local buffers as much as possible and only transmit when enough data for 'full' packets is queued and enough space is available for reception. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, adding the values is really helpful! A short comment on the 'bad' interaction: It is not only a concern when it comes to latency. I observed problematic behaviour in the following situations:
|
||||||||||
Per default, Nagle's algorithm is disabled and delayed acknowledgements are enabled. Note that enabling both features may cause severe performance losses as well as non-deterministic behaviour. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I would probably reword this to get away from using 'enabled' and 'disabled' so much - it at least confused me a fair bit 😹 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excellent hint! I was getting confused as well 😁 |
||||||||||
Latency peaks of 40 ms and a large throughput variance have been observed in this case so far. | ||||||||||
|
||||||||||
Message Aggregation | ||||||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
For the time-synchronized case, |ProductName| offers the possibility of aggregating messages prior to sending. | ||||||||||
This feature can be enabled via the :doc:`EnableMessageAggregation<../configuration/experimental-configuration>` parameter in the participant configuration file. | ||||||||||
We mention that the message aggregation feature has a significant impact on the throughput, in particular if several small messages (<1kB) are sent within one simulation step. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think changing the default value is a good idea. However, this will 'surprise' everyone who hasn't explicitly set this configuration value to
false
. We should carefully evaluate if this could be an issue. We should also think about how this should influence our version number - or the configurationSchemaVersion
(my gut reaction is to increment theSchemaVersion
, but treat this specifically as a patch for SIL Kit).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, we have no prescedent for incrementing the
SchemaVersion
like this. And we also need some code to actually handle varying defaults (e.g.) in differentSchemaVersion
s.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main issue I see in changing the default value, is for users that have configurations where they only set
TcpQuickAck: true
but do not specifyTcpNoDelay
(because they relied on the old default).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, users who did not explicitly set the TCP middleware options may experience different behaviour.
However, we only change the default config value, not the code itself. Does that justify a version increment?
Maybe, a short remark in the release notes is already sufficient?