Skip to content

Disable Nagle's Algorithm #921

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

Closed
bgrainger opened this issue Jan 3, 2021 · 3 comments
Closed

Disable Nagle's Algorithm #921

bgrainger opened this issue Jan 3, 2021 · 3 comments

Comments

@bgrainger
Copy link
Member

According to https://en.wikipedia.org/wiki/Nagle%27s_algorithm:

In general, since Nagle's algorithm is only a defense against careless applications, it will not benefit a carefully written application that takes proper care of buffering; the algorithm has either no effect, or negative effect on the application.

Since MySqlConnector does buffer writes (it has to know the length of the data that will be transmitted in order to create the MySQL packet header), it seems that Nagle's Algorithm is unnecessary, and possibly harmful.

It may be beneficial to set SocketOptionName.NoDelay on the socket opened by the client, in case the server is using delayed ACKs?

@bgrainger
Copy link
Member Author

bgrainger commented Jan 3, 2021

It may also be useful to turn off delayed ACKs via dotnet/runtime#798 (comment)

Per John Nagle (https://news.ycombinator.com/item?id=10608356):

Short version: set TCP_QUICKACK. If you find a case where that makes things worse, let me know.

@bgrainger
Copy link
Member Author

Fixed in 1.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant