HTTP: Increase max read buffer size to 128KB#3080
Open
hofst wants to merge 1 commit into
Open
Conversation
Increase the default read buffer size in read_size from 64KB to 128KB. This change aligns with optimizations in Asio/SSL to reduce io_context contention and CPU utilization by allowing larger reads per operation.
Author
|
@vinniefalco Opened the PR as discussed in the issue here: #3062 |
Collaborator
|
@hofst, it looks like Chris has responded to your issue with this commit: chriskohlhoff/asio@873cb09. For the Beast part, you can overload beast::read_size_helper for beast's buffer types, or introduce a custom buffer type and struct tuned_buffer : beast::flat_buffer
{
using beast::flat_buffer::flat_buffer;
};
std::size_t
read_size_helper(tuned_buffer& b, std::size_t)
{
std::size_t const remaining = b.max_size() - b.size();
return (std::min)(std::size_t{131072}, remaining);
}Here is a complete example: https://godbolt.org/z/xTM7sY5MK. |
Author
|
@ashtum That's great, thank you! Now the main part that is missing is the multi-TLS decode per task. The encode-side (upload path) has the same problem by the way and needs a multi-encode implementation to utilize large machines efficiently and fully. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Increase the max read buffer size in read_size from 64KB to 128KB. This change aligns with another optimizations in Asio/SSL to reduce io_context contention and CPU utilization by allowing larger reads per operation: chriskohlhoff/asio#1712