-
Notifications
You must be signed in to change notification settings - Fork 7.3k
lib: introduce .setMaxSendFragment(size)
#6900
Conversation
@@ -627,6 +627,10 @@ has been established. | |||
ANOTHER NOTE: When running as the server, socket will be destroyed | |||
with an error after `handshakeTimeout` timeout. | |||
|
|||
### tlsSocket.setMaxSendFragment(size) | |||
|
|||
Set maximum TLS fragment size (default value is: `16384`). |
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.
It would be great to use a lower max size. Ideally, it would be adjusted over the lifetime of the connection, but at a minimum, we want to eliminate the CWND overlfow case on new connections + slow-start after idle cases... Setting fragment size to ~8k would do the trick (assuming we're on IW10 server).
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.
It affects throughput significantly, I did benchmarks of bud with and without this option enabled and the difference was dramatical. Also, default value is set by OpenSSL, not us.
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.
Out of curiosity, do you have your bud benchmark numbers published anywhere?
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.
Yep, these are with max send fragment set to nearly MTU value (~1300 or a bit less): indutny/bud#20 (comment)
And here are results without max send fragment:
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.
There're no bandwidth metric, so you could only believe me and observe lower RPS :)
Do you have any particular reason in mind? Config flag is definitely a good start (and kudos for super-quick turnaround!), but I'd love to see a smarter strategy in node. |
Sometimes it's not always in our best interest to implement (and then maintain) optimizations around specific implementations that could be subject to bikeshedding. Ideally we're working to provide APIs in core that allow external consumers to handle these features in the module space. By simply making this configurable, it allows someone to publish the auto-window management without Node being opinionated about what that means. |
@tjfontaine I guess from a framework perspective that approach makes sense. That said, my reservation with this line of thinking is the suboptimal "out-of-the-box" experience: most developers won't know to enable an extra module or add that extra config flag, hence the majority of deployed servers will continue to use the suboptimal settings and users will incur higher TTFB than necessary. The advantage of the dynamic strategy is that you can meet both goals: optimize TTFB for interactive traffic, and provide good through for bulk transfers. No configuration needed, unless you want to tweak the boost threshold. |
@igrigorik I understand your sentiment, but more often than not deployments are using servers like restify, hapi, or express -- each with their own priorities regarding what they're designed to provide. They are in a much better place to define the policy and mechanism they want to adopt. They could even use the module system to share implementations among each other. This is the ethos of core and of the ecosystem in general. As far as TTFB considerations for people using |
@indutny @tjfontaine sg. What do you guys think of the following for the documentation: Set maximum TLS fragment size (default value is: Not sure what the policy is about linking to external sites in the doc, but if it makes sense: |
That is very meaningful documentation, thank you! Though, I'll insert it without links. |
@indutny sg, thanks! |
Pushed update. |
@igrigorik fixed. |
@tjfontaine please review |
will do |
### tlsSocket.setMaxSendFragment(size) | ||
|
||
Set maximum TLS fragment size (default and maximum value is: `16384`, minimum | ||
is: `512`). Returns `true` on success, `false` otherwise. |
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.
Can we add test coverage on this part? Is there an upper bound?
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.
Yep 16384
, will add test tomorrow.
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 test coverage.
lgtm |
Thank you, landed in 7f9b015 |
fix #6889