Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable proxy buffering in nginx #2844

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Conversation

RexTim
Copy link
Contributor

@RexTim RexTim commented Feb 29, 2024

Setting the proxy_buffering directive to “off” is a common mistake because it can cause performance issues and unexpected behavior in NGINX. When proxy buffering is disabled, NGINX receives a response from the proxied server and immediately sends it to the client without storing it in a buffer. This can cause problems if the response is large or if the connection between NGINX and the client is slow, because it can result in increased memory usage and potentially lead to request timeouts.

To avoid this mistake, it is recommended to always enable proxy buffering in NGINX.

Resolves #2836

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Setting the proxy_buffering directive to “off” is a common mistake because it can cause performance issues and unexpected behavior in NGINX. When proxy buffering is disabled, NGINX receives a response from the proxied server and immediately sends it to the client without storing it in a buffer. This can cause problems if the response is large or if the connection between NGINX and the client is slow, because it can result in increased memory usage and potentially lead to request timeouts.

To avoid this mistake, it is recommended to always enable proxy buffering in NGINX.
Copy link
Member

@hubertdeng123 hubertdeng123 left a comment

Choose a reason for hiding this comment

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

seems fine, proxy buffering is enabled by default

@hubertdeng123 hubertdeng123 merged commit 0c55e80 into getsentry:master Feb 29, 2024
6 checks passed
@aminvakil
Copy link
Collaborator

Also to add https://www.nginx.com/blog/avoiding-top-10-nginx-configuration-mistakes/#proxy_buffering-off

But maybe we should think about changing proxy_buffer_size as well.

@aminvakil
Copy link
Collaborator

I guess I was late about 5 seconds :)

@RexTim
Copy link
Contributor Author

RexTim commented Feb 29, 2024

@aminvakil proxy_buffer_size is set to 128k, I believe it should be sufficient for most cases?

https://github.com/getsentry/self-hosted/pull/2844/files#diff-4adaaefa7fc959e7dfe65e8dc8dadc9ee27ddd284eee3426463b1cdc000587d5R40

@aminvakil
Copy link
Collaborator

@RexTim Oops, as it was disabled, I thought they have not been set as well.

All good, and thanks for this!

@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

After 24.1.1 upgrade: envelope buffer capacity exceeded
3 participants