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

storage: remove kafka producer limits in sinks #24784

Merged
merged 2 commits into from
Jan 31, 2024

Conversation

petrosagg
Copy link
Contributor

Motivation

The kafka sink operator has nothing better to do with incoming data other than to buffer them, which provides no additional value than to send them to librdkafka and let that buffer them instead.

The operator is already set up to never buffer messages that are ready to send but the current limits are too conservative. If a large snapshot arrives fast enough then it is possible to reach the 10M message limit and cause the sink to restart. I have observed this happening locally during benchmarking.

For this reason this PR disables rdkafka message count and size limits.

Tips for reviewer

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • This PR includes the following user-facing behavior changes:

@petrosagg petrosagg requested review from bkirwi and a team January 29, 2024 14:22
options.insert("queue.buffering.max.kbytes", "2147483647".into());
// Disable the default buffer limit of 100k messages. We don't want to impose any limit
// here as the operator has nothing better to do with the data than to buffer them.
options.insert("queue.buffering.max.messages", "0".into());
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we not have the fix to confluentinc/librdkafka#4018 in our fork? might explain the test failures

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't :(

The  kafka sink operator has nothing better to do with incoming data
other than to buffer them, which provides no additional value than to
send them to `librdkafka` and let that buffer them instead.

The operator is already set up to never buffer messages that are ready
to send but the current limits are too conservative. If a large snapshot
arrives fast enough then it is possible to reach the 10M message limit
and cause the sink to restart. I have observed this happening locally
during benchmarking.

For this reason this PR disables rdkafka message count and size limits.

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Copy link
Contributor

@guswynn guswynn left a comment

Choose a reason for hiding this comment

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

This looks fine as long as ci passes! we might want to come back and add LD flags for this

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
@petrosagg petrosagg merged commit 832c0c9 into MaterializeInc:main Jan 31, 2024
66 of 67 checks passed
@petrosagg petrosagg deleted the kafka-sink-limits branch January 31, 2024 18:21
benesch added a commit to benesch/materialize that referenced this pull request Jul 1, 2024
Now that we're on librdkafka v2.4.0, we don't need to catch and retry
QueueFull errors, but can instead disable the queue limit.

This commit is a combination of:

  * Reverting the QueueFull workaround from MaterializeInc#24871
  * Reapplying Petros's original implementation in MaterializeInc#24784

Co-authored-by: Petros Angelatos <petrosagg@gmail.com>
umanwizard pushed a commit to umanwizard/materialize-1 that referenced this pull request Jul 3, 2024
Now that we're on librdkafka v2.4.0, we don't need to catch and retry
QueueFull errors, but can instead disable the queue limit.

This commit is a combination of:

  * Reverting the QueueFull workaround from MaterializeInc#24871
  * Reapplying Petros's original implementation in MaterializeInc#24784

Co-authored-by: Petros Angelatos <petrosagg@gmail.com>
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