-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new ChannelOption to get the amount of buffered outbound data in …
…the Channel (#2849) Add ability to get the amount of buffered outbound data from `Channel` ### Motivation: Right now, SwiftNIO does not have the API to answer the question "how much data is buffered in the Channel". Applications focusing on performance may need to fine-tune the amount of outbound data that will be sent to optimize data throughput, adjust sending rate to avoid overflow, and potentially reduce latency. SwiftNIO currently provides some backpressure mechanism. This new API will be a good addition. By knowing how much data is buffered directly, applications can make informed decision to adjust for optimal buffer sizes and send rates. ### Modifications: - Expose current buffer size through ChannelOptions so that users can read the value out. StreamSocketChannel, DatagramSocketChannel, EmbeddedChannel, and AsyncTestingChannel have the same API interface. - Various modifications to the existing tests to make sure the new API is working correctly. - Add a new `so_sndbuf` socket option so that users can easily adjust the send buffer size. ### Result: Users can get the amount of outbound bytes currently buffered in the `Channel` through the new `BufferedWritableBytesOption` channel option. --------- Co-authored-by: Cory Benfield <[email protected]>
- Loading branch information
Showing
13 changed files
with
566 additions
and
3 deletions.
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
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
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
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
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
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
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
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
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
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.