Subject: Re: [tcpm] [Lwip] WGLC review of draft-ietf-lwig-tcp-constrained-node-networks

From: "Carles Gomez Montenegro" <[email-masked]>
Date: Wed, 5 Jun 2019 11:28:06 +0200

Dear Markku,

Thank you very much for your comprehensive and detailed review of the
draft. Your constructive comments have been very useful to address issues
and improve the quality of the document. Our updates can be found in
revision -08.

Please find below our inline responses to your comments.

> Hi all,
>
> I have reviewed the -07 version of this draft for the WGLC.
>
> The draft is very useful for many developpers using or considering of
> using TCP in CNN scenarious. It has improved a lot from the previous
> versions but there are still a number of issues worth addressing.
>
> See comments below.
>
> Best regards,
>
> /Markku
>
> Sec 4.1.
>
> Title: Path properties
> - Would it be better to use "Addressing path properties" or something
> similar as TCP cannot (much) affect the properties?

Sounds good!

> Sec. 4.1.1.
>
> If I understand it correctly, the discussion in this section is intended
> to be all about avoiding Path MTU discovery when running TCP oevr IPv6?
> Therefore, "Avoiding Path MTU Discovery in IPv6" would probably be
> a better title?

>From our point of view, the section is actually about setting the MSS to a
suitable value, which then may help avoiding the need to support Path MTU
Discovery, but also the need to perform IP-layer fragmentation at the
source. We have explicitly added the latter in -08.

> In addition, to my understanding TCP implementations typically address
> the presence of TCP options such that they eat the necessary space for
> TCP options from the payload, not by increasing the IP datagram size
> if TCP options are present. For example, if SMSS is set to, let's say
> 1460 octets, and a TCP sender adds a TCP timestamp option (12 bytes) it
> will send only 1448 bytes of payload in a TCP segment?
>
> What the draft now says in this respect is on the safe side, but it
> might be overcautious. I don't remember any RFC saying how SMSS and
> adding options to a TCP segment are related. Maybe someone of the TCP
> implementors may shed more light to this how?

We have tried to address your two comments above. On this matter, we had
received feedback that this measure (advertising an MSS smaller than 1220
bytes) would be safe, but we have tried to reflect that this might not be
necessary, and even overcautious.

> The second but last para discussing IPv4 in this context is very
> confusing. In particular, the 2nd sentence
>
>   "In IPv4, the MTU is 576 bytes."
>
> is simply incorrect. In IPv4 the requirement is that any host must be
> able to accept datagrams of up to 576 octets, but there is no upper
> limit of 576 for IPv4 MTU!

Indeed. The 2nd sentence missed the word “minimum” before “MTU”, and we
have made several updates to the paragraph.

> Sec. 4.1.2.
>
>   "In such traffic patterns, it is more difficult to
>    detect packet loss without retransmission timeouts ..."
>
> ->
>
>   "In such traffic patterns, it is more difficult and often
>    impossible to detect packet loss without retransmission timeouts
>    unless ECN is enabled ..."

Done.

>
>   "When the congestion window of a TCP sender has a
>   size of one segment, the TCP sender resets the retransmit timer, and
>   the sender will only be able to send a new packet when the retransmit
>   timer expires [RFC3168]. Effectively, the TCP sender reduces at that
>   moment its sending rate from 1 segment per Round Trip Time (RTT) to 1
>   segment per RTO, which can result in a very low throughput.  In
>   addition to better throughput, ECN can also help reducing latency and
>   ECN can also help reducing latency and	jitter."
>
> This text is somewhat inaccurate in terms of how ECN works if only a
> single segment is in flight (cwnd = 1 MSS) and confusing when it says
> "which can result in a very low throughput". The latter is kind a true,
> but also necessary to avoid congestion and, after all, it may result in
> higher throughput compared to the case where ECN is not used and
> retransmissions are needed.
>
> I'd rephrase the above to something along the lines:
>
>   "When the congestion window of a TCP sender has a
>   size of one segment and a TCP ACK with an ECN signal (ECE flag) arrives
>   at the TCP sender, the TCP sender resets the retransmit timer, and
>   the sender will only be able to send a new packet when the retransmit
>   timer expires. Effectively, the TCP sender reduces at that
>   moment its sending rate from 1 segment per Round Trip Time (RTT) to 1
>   segment per RTO and reduces the sending rate further on each ECN signal
>   received in subsequent TCP ACKs. Otherwise, if an ECN signal is not
>   present in a subsequent TCP ACK the TCP sender resumes the normal
>   ack-clocked transmission of segments [RFC 3168].

Thank you very much for the proposed text. The draft has been updated
accordingly.

> It might be also good to rearrange the text in the second and third
> paragraphs to disscuss the effect of retrasmission and timeouts more
> coherently. I may suggest text for this.

We will welcome any suggestion you may have in this regard.

> Sec 4.2.
>
>   "This section discusses TCP stacks that focus on transferring a single
>    MSS."
>
> Maybe better:
>
>   "This section discusses TCP stacks that allow transferring only a single
>    MSS at a time."

Done.

> Sec 4.2.1.
>
> Last sentence:
>
>   "For this use of CoAP, a maximum TCP window
>    of one MSS will be sufficient."
>
> This is not necessarily true. If both TCP stacks involved allow a TCP
> window larger than 1 MSS and a CoAP request or response larger than one
> MSS is in use, it can be delivered more efficiently than in case where
> max TCP window is one MSS.
>
> Furthermore, this may also not be the case if a CoAP over TCP
> application uses short-lived TCP connections. Why? Because then the
> mandatory CSM message that each CoAP endpoint sends after the 3WHS may
> introduce an additional RTT as it cannot necessarily be sent during the
> same RTT with the first CoAP request/response. Of course, if the CSM
> message and the first CoAP request/response message fit into a single
> MSS and the TCP Nagle algorithm is disabled, such a single MSS window
> does not result in an additional RTT.

We have updated the sentence accordingly.

> Sec. 4.2.2.
>
>   "A TCP implementation for a constrained device that uses a single-MSS
>   TCP receive or transmit window size may not benefit from supporting
>   the following TCP options: Window scale [RFC7323], TCP Timestamps
>   [RFC7323], Selective Acknowledgments (SACK) and SACK-Permitted
>   [RFC2018]."
>
> It may be useful to mention that a TCP sender can benefit from
> Timestamps in detecting spurious RTOs that are quite likely to occur
> in CNN scenarios.

Done.

>
> Sec. 4.2.3.
>
> 2nd para:
>
>   "A device that advertises a single-MSS receive window should avoid use
>   of Delayed ACKs in order to avoid contributing unnecessary delay (of
>   up to 500 ms) to the RTT [RFC5681], which limits the throughput and
>   can increase the data delivery time."
>
> This should not appear as a generic recommendation as it is not
> correct for some typical usage scenarios such as request-response
> traffic where the node with a single-MSS receive window is the server
> sending the responses. With delayed ACKs it can biggyback the TCP ACK
> with the response if the response is sent before the delayed ACK timer
> expires, thus avoiding unnecessary pure TCP ACKs.
>
> So, here, like in Sec 4.3.2., it is important to indicate that it depends
> on the communication pattern whether delayed ACKs are useful or harmful.

We have modified this text accordingly.

> 3rd para:
>
>   "A device that can send at most one MSS of data is significantly
>   affected if the receiver uses Delayed ACKs, e.g., if a TCP server or
>   receiver is outside the CNN."
>
> Again, this does not hold in all cases. E.g., if the server is outside
> of the CNN and request-response communication is used.

We have modified and reorganized the text accordingly.

> The "split hack" is not advisable workaround. First for the reason
> stated in the end of the para, but more importantly because it simply
> does not necessarily even work; a TCP receiver is requited to
> acknowledge every second full-sized segment, but not two consecutive
> small segments.

Agreed. This comment has been incorporated into the text. We discuss the
“split hack”, but we do not recommend it.

> 4th para:
>
>   "Similar issues happen when a sender uses the Nagle algorithm.
>   Disabling the algorithm will not have impact if the sender can only
>   handle stop-and-wait operation."
>
> Actually it does have an impact in some specific usage scenarios, e.g.,
> with CoAP over TCP disabling the Nagle algorithm allows sending the
> mandatory CSM message and the first CoAP  msg (request) and possibly
> also CSM and the first response without unnecessarily waiting for a TCP
> ACK of the CSM msg. This is of particular impact if short-lived TCP
> connections are in use with CoAP over TCP.

The text above refers to stop-and-wait operation. In your example above,
were you considering stop-and-wait operation?

> Sec. 4.2.4.
>
> RTO is not estimated but calculated using estimated RTT and deviation
> from it. That is, modify:
>
> RTO estimation -> RTO calculation

Done.

> 2nd para:
>   "[RFC6298] describes the standard TCP RTO algorithm."
>
> You may delete this sentence and cite RFC 6298 in the first sentence
> of the Sec 4.2.4 where the algorithm is first mentioned.

Done.

> 3rd para:
>   "As an example, an adaptive RTO algorithm for CoAP over UDP has been
>   defined [I-D.ietf-core-cocoa] that has been found to perform  well in
>   CNN scenarios [Commag]."
>
> Maybe not a good idea to cite the current version of CoCoA RTO
> algorithm (v3) that have been found also to have detrimental behavior?

Done.

>
> Sec. 4.3.1.
>
>   "Assuming that Delayed ACKs are used by the receiver, the
>   mentioned algorithms work efficiently for window sizes of at least 5
>   MSS: If in a given TCP transmission of segments 1, 2, 3, 4, 5, and 6
>   the segment 2 gets lost, the sender should get an ACK for segment 1
>   when 3 arrives and duplicate acknowledgements when 4, 5, and 6
>   arrive. It will retransmit segment 2 when the third duplicate ACK
>   arrives. In order to have segment 2, 3, 4, 5, and 6 sent, the window
>   has to be at least 5 MSS. With an MSS of 1220 byte, a buffer of the
>   size of 5 MSS would require 6100 bytes."
>
> The requirement for the window size to be of at least 5 segments does
> not hold if Limited Transmit is in use.

We have updated the text (including that now we mention “up to 5 MSS”),
along with updates in the Limited Transmit paragraph.

> Also, the requirement of at least 5 segments is valid only if the ACK
> for the segment 1 was held by the DelAck timer, i.e., the requirement
> holds approx. with 50% probability. That is, if the segment 1 got
> acknowledged (because there was also a segment before segment 1 and
> that was held by DelAck timer), only a window size of 4 MSS is needed.

We have modified the text accordingly.

>   "For bulk data transfers further TCP improvements may also be useful,
>   such as limited transmit [RFC3042].
>
> Limited Transmit is not useful only for bulk data transfers but for any
> transfer that has more than one segment in flight. Small transfers tend
> to benefit more, because they are more likely to not receive enough
> dupacks.

We have modified the paragraph accordingly.

> Sec. 4.3.1.1.
>
>   "... a sender (having previously sent the SACK-Permitted
>   option) can avoid performing unnecessary retransmissions, saving
>   energy and bandwidth, as well as reducing latency."
>
> It might be worth mentioning also that SACK often allows for faster
> loss recovery when there is more than one lost segment in a window of
> data (i.e., recovery with less RTTs).

Done.

> Sec. 4.3.2.
>
> Disabling delayed ACKs on a client for infrequent request-response
> traffic with small messages might be advisable, too. It would allow
> an immediate ACK for the data segment carrying the response.
>
> This comment holds for Sec. 4.2.3 as well.

Added, thanks.

> Sec. 5.3.
>
>   "A mean TCP NAT binding timeout of 386
>    minutes has been reported, while in some cases, inactivity timeouts
>    are in the order of a few minutes [HomeGateway].
>
> Reporting just the mean TCP NAT binding timeout from [HomeGateway] does
> not give a correct view of the results in this study, because the
> meaasured timeouts were highly variable and some devices had a very long
> timeout (or no timeout at all), yielding a very high mean timeout value.
> Therefore, we reported median and it would be more descriptive to report
> it here as well. The median of the measured TCP NAT binding timeouts in
> this study was around 60 mins, the shortest being around 2 mins. That is,
> clearly more than 50% of the devices had timeout shorter than RFC
> 5382 recommended minimum of 124 mins.
>
> In the light of these results, it may be hard to find a proper timeout
> value for the application-layer heartbeat messages, and it might be
> worth mentioning, I think.

We have updated the section based on these comments.

> Nits:

All done, except for the “Bit-Error Rate” suggestion. The Collins English
dictionary uses the non-hyphenated form.

> Sec 1:
>
> 1st para: Add references and cite  6LoWPAN, RPL, and CoAP.
>
>
> 3rd para: "At the application layer, CoAP was developed over UDP
> [RFC7252]."
>
> - this seems to cite UDP incorrectly while the intent is to cite CoAP.
>    If you cite CoAP in the first para, you do not need to cite here at
> all.
>
>   "This the main reason..." -> "This is the main reason..."
>
>
> 5th para:
>
>   "Given the limited resources on constrained devices, careful "tuning"
>    of the TCP implementation can make an implementation more lightweight."
>
> Instead of saying "tuning" of the TCP implementation, I'd say that careful
> selection of optional TCP features can make an implementation more
> lightweight (and improve operation in CNNs).
>
> 6th para:
>
>   "This document provides guidance on how to implement and use TCP in
>    CNNs.
>
> ->
>
>   "This document provides guidance on how to implement and configure TCP
>    as well as how TCP is advisable to be used by applications in CNNs.
>
>
> Sec 3.1., last para:
>
>   high bit error rate ->  high bit-error rate
>
>
> Sec 5., first sentence:
>
>   "how a TCP stack can be used" ->  "how TCP can be used"

Once again, thank you very much for your comprehensive review and
constructive suggestions!

Cheers,

Carles (on behalf of all authors)