Skip to content

Conversation

@camshaft
Copy link
Contributor

@camshaft camshaft commented Dec 4, 2024

Description of changes:

This change makes TCP shutdown a no-op. This is done for a few reasons:

  • We already authenticate stream closures at the record layer so doing it in TCP is redundant
  • It avoids an extra syscall

Above all, we can avoid more complex shutdown behavior in the TCP layer:

https://datatracker.ietf.org/doc/html/rfc9293#section-3.3.2

A RST can be sent from any state with a corresponding transition to TIME-WAIT (see [70] for rationale). These transitions are not explicitly shown; otherwise, the diagram would become very difficult to read. Similarly, receipt of a RST from any state results in a transition to LISTEN or CLOSED, though this is also omitted from the diagram for legibility.

Basically, we don't need to go through the 4-way finalization flow but instead jump directly to TIME-WAIT. When combined with linger=0, this can release sockets a lot sooner to the OS which enables busy machines to handle higher TPS (see https://doi.org/10.1109/INFCOM.1999.752180).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@camshaft camshaft marked this pull request as ready for review December 4, 2024 18:21
Copy link
Collaborator

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also consider the linger=0 change being default, but I think it can happen separately.

@camshaft camshaft merged commit f8f2361 into main Dec 4, 2024
129 of 130 checks passed
@camshaft camshaft deleted the camshaft/dc-tcp-noop-shutdown branch December 4, 2024 19:53
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.

2 participants