-
Notifications
You must be signed in to change notification settings - Fork 434
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
DIRMINA-1173 #44
Merged
Merged
DIRMINA-1173 #44
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
0cbbc8b
working on the multi-phase synchronization; it was working before but…
jon-valliere ec93bb7
nonblock SSL now passes all tests
jon-valliere d393ad7
found one place where the UNACK was calculated wrong
jon-valliere 1a4fbda
typos
jon-valliere 05028e8
found an issue where async task execution was always happening inline
jon-valliere f5f70ed
add accidentally removed sync
jon-valliere 93a4ff7
small change to the control flow for public methods
jon-valliere ed97be8
adds separate event queue - this is temporary because I don't like th…
jon-valliere 62643fe
alright lets remove all the synchronization from the queue flushes
jon-valliere df98d09
Free a useless buffer.
elecharny 46fb20f
Merge branch '2.2.X' into bugfix/DIRMINA-1173
elecharny 13d5019
removed a useless import
elecharny cc86146
Used an AtomicBooleaninstead of using a lock
elecharny 57767e4
Added some new lines for clarity
elecharny df0ecc6
Disable Nagle's algorithm by default
elecharny 495a282
Revert the change made on the TCP_NODELAY default value.
elecharny 0daeb7b
Upgraded PMD to 7.0.0 and pmd-pligin to 3.22
elecharny 6ab8003
Give more significant name to a variable
elecharny e3dc20b
Switched to Easymock 5.4.0 as a replacemnt for rmock, hich does not
elecharny ac9ce3f
Bumped up ognl dependency and PMD
elecharny 2904be1
Bumped up some maven dependencies
elecharny dd403eb
Bumped up maven dependency versions
elecharny 0fc698a
Added a JenkinsFile
elecharny 994a00b
Deleted badly named Jenkinsfile
elecharny cf86678
Renamed the Jenkinsfile
elecharny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hey @elecharny I'm not sure this is a good idea. If we want todo this also, I think it should be as part of a separate PR.
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.
Hi @jon-valliere, just read this blog post: https://brooker.co.za/blog/2024/05/09/nagle.html
Somehow, Nagle's algorithm is a thing of the past (ie when we were dealing with terminals over slow connections). In MINA's context, and if we except SSHD, I do think that the default to disable Nagle's algorithm actually makes sense. Most of MINA based application don't deal with char by char communication, rather with quite big chunks of data, so there is little need to wait for an ACK from the server.
Anyway, this is configurable, so I guess it should not be a big deal.
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.
Disabling Nagle by default may create context switching performance hits in certain applications. Any situation where you may invoke more than one write in sequence, receives performance boosts from the way the IO scheduler works in TCP because it can produce MORE packets in a single go and does not have to be woken up as often. The OS itself does not disable Nagle by default and I do not think we should make this decision for the end user. As long as they can configure it, I think the default should be
unset
(to allow the OS default to apply). If other applications, built on MINA, want to configure a new default then it is up to them. For SSHD or Apache Directory, if you want to disable Nagle there, that is fine.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.
Not arguing here, I will revert but...
I do think that this flag should be opt-in, ie the Nagle algorithm should be disabled by default. The use cases were it's useful are not really the most frequent, and the drawbacks are numerous. If the default sendBuffer size is set to 64Ko, then you have a delayed for every packet that has a lower number of bytes to transfert. if you set the sendBuffer size to a lower value, then you are sending way more packet than needed. In any case, if you are to send some data that span on more than one packet, and the last packet is not completed, then you'll pay a 200ms delay every time. Not very cool.
With Gigabits connections, sending a lot of packets is not really an issue anymore, except on heavily loaded applications that aren't interactive (HTTP may enter into this category, but with REST application, I would argue that an immediate sending is a plus).
Regarding LDAP, requests are small there is no interest in differing the packet sendings, so yes, I'm likely to deactivate the Nagle Algorithm.
Seems like on Linux they have added the TCP_CORK parameter to let the sender decide when to send the data, bypassing the Nagle's algorithm completely, and also solving the context switching pb at the same time (somehow it's a way to say "you're responsability, not teh OS one", and I tend to agree). Sadly, this is not portable, so currently it's not an option.
Last, not least, for TLS HS, Nagle's Algorithm is delaying the whole negociation, which is a real PITA...
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.
In my other IO framework, all of the TCP/SOCK options all have
unset
states where the framework code will not call the SOCK configuration at all and allow the OS defaults to be applied.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.
See https://en.wikipedia.org/wiki/Nagle%27s_algorithm
Nagle only really applies for when the packets are smaller than the MSS which is usually 1280 bytes. AFAIK only the HELLO message in TLS HS is smaller than this; all other messages SHOULD be aggregated together by the SSL layer. There IS a well known interaction with Nagle and Delayed Ack which can cause Nagle to be worse than it would be by itself. What is the order of delays you are seeing?
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 missed the MSS part. Ok, so makes sense to keep the parameter as is, but I do agree that not setting a default at all would be a better option. At least, you let the developer makes a choice depending on what they actually measure.
Thanks Jon!