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

avoid consuming receive buffers when blocked by queue #211

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yaauie
Copy link
Contributor

@yaauie yaauie commented Feb 25, 2023

By disabling auto-read and triggering reads when a channel becomes active or when the previous read on a channel has completed, we avoid pulling bytes out of our TCP receive buffer prematurely, which allows the normal mechanisms of TCP back-pressure to work as expected.

When auto-read enabled, an input experiencing back-pressure from the pipeline's queue would effectively avoid propagating that back-pressure by continuing to transfer bytes from the receive buffer into effectively unlimited direct memory buffers until it reached netty's memory allocation limit (killing the connections and losing all protocol-acked-but-unprocessed bytes) or an OOM was reached by allocating more memory than was available (crashing the whole process)

It is likely that disabling auto-read will have some negative effect on throughput with the default-size receive buffers, and that we will also need to tune these or provide a way to make them user-tunable.

Thanks for contributing to Logstash! If you haven't already signed our CLA, here's a handy link: https://www.elastic.co/contributor-agreement/

By disabling auto-read and triggering reads when a channel becomes active
or when the previous read on a channel has completed, we avoid pulling bytes
out of our TCP receive buffer prematurely, which allows the normal mechanisms
of TCP back-pressure to work as expected.

When auto-read enabled, an input experiencing back-pressure from the
pipeline's queue would effectively avoid propagating that back-pressure
by continuing to transfer bytes from the receive buffer into effectively
unlimited direct memory buffers until it reached netty's memory allocation
limit or an OOM was reached by allocating more memory than was available.

It is likely that disabling auto-read will have some negative effect on
throughput with the default-size receive buffers, and that we will also
need to tune these or provide a way to make them user-tunable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants