Skip to content

Add config: buf_read_size#3068

Open
southball wants to merge 3 commits intobenoitc:masterfrom
southball:feature/buf-read-size-config
Open

Add config: buf_read_size#3068
southball wants to merge 3 commits intobenoitc:masterfrom
southball:feature/buf-read-size-config

Conversation

@southball
Copy link
Copy Markdown

Resolves #2596.

Add the --buf-read-size option to set the block size when reading request body.

Comment thread docs/source/settings.rst

**Default:** ``1024``

Buffer read size from request data
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Buffer read size from request data
Buffer read size for reading request data from socket

Comment thread gunicorn/config.py
if buf_read_size is None:
return 1024

return int(buf_read_size)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should add some exception handling here if buf_read_size is not convertable to int and return a explanatory error.

@aamirawan7584
Copy link
Copy Markdown

@southball do you think we need to use this buffer size config according to content-length because for small request data setting a big buffer size could decrease the performance?

@pajod
Copy link
Copy Markdown
Contributor

pajod commented May 21, 2024

@aamirawan7584 The way we use it, a larger setting than what was sent should not negatively impact the processing of small requests. However, incorrectly reducing our buffer sizes in response to arbitrary client input could cause trouble, so should not be attempted without good reasons & mechanisms.

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.

Slow processing when receiving large data via POST

3 participants