Skip to content

HTTP: Increase max read buffer size to 128KB#3080

Open
hofst wants to merge 1 commit into
boostorg:developfrom
hofst:develop
Open

HTTP: Increase max read buffer size to 128KB#3080
hofst wants to merge 1 commit into
boostorg:developfrom
hofst:develop

Conversation

@hofst

@hofst hofst commented Feb 6, 2026

Copy link
Copy Markdown

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

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.
@hofst hofst changed the title HTTP: Increase default read buffer size to 128KB HTTP: Increase max read buffer size to 128KB Apr 1, 2026
@hofst

hofst commented Apr 1, 2026

Copy link
Copy Markdown
Author

@vinniefalco Opened the PR as discussed in the issue here: #3062

@ashtum

ashtum commented Jul 7, 2026

Copy link
Copy Markdown
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 http::read_some and http::read will pick up that overload, for example:

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.

@hofst

hofst commented Jul 7, 2026

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants