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
Allow setting TCP low_latency with SSL listener, minor fixes #3065
Conversation
lib/puma/binder.rb
Outdated
@@ -251,7 +251,8 @@ def parse(binds, log_writer = nil, log_msg = 'Listening') | |||
else | |||
ios_len = @ios.length | |||
backlog = params.fetch('backlog', 1024).to_i | |||
io = add_ssl_listener uri.host, uri.port, ctx, optimize_for_latency = true, backlog | |||
opt = params.key?('low_latency') && params['low_latency'] != 'false' |
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 I would prefer:
opt = params.key?('low_latency') && params['low_latency'] != 'false' | |
low_latency = params['low_latency'] != 'false' | |
io = add_ssl_listener uri.host, uri.port, ctx, low_latency, backlog |
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 can change the variable name from opt
to low_latency
, but it is false by default, so the conditional should stay the same. Also, the code added is the same as line 161, which is used with tcp connections:
Line 161 in 3f4e3c8
opt = params.key?('low_latency') && params['low_latency'] != 'false' |
Thoughts?
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.
Added a commit renaming the variable from opt
to low_latency
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.
Style comment but otherwise 👍
Been doing a deep dive into specs, etc. The main issue here is the line below, in particular Line 254 in 6da32ca
So, that should be fixed, but then the question is how. Currently, that uses a value of Also, the DSL helper functions for SSL (DLS.ssl_bind_str & DSL#bind_str) do not pass this setting on, so it would be best to fix that (which this PR currently does not). I did some quick benchmarks, and saw very little change with various values of Finally, given the odd current behavior, we should leave the SSL default as JFYI, I was the one who merged this... |
Yup, sounds good. |
f46c4ce
to
79e81d0
Compare
Updated as per above. Or, the |
Description
Started with the following warnings in Ruby 2.4:
Fixed the above, rather trivial.
Then, while looking at the 'optimize_for_latency' warning, discovered that the TCPServer started for an SSL connection was not passed the 'low_latency' argument.
Fixed, and added tests to
test_binder.rb
&test_config.rb
, which is the last commit. Cherry-pick the test commits to master, it shows the following three failures:Your checklist for this pull request
[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.