Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add blocking flow controls to the PubSub Sink connector#282

Merged
samarthsingal merged 1 commit into
GoogleCloudPlatform:masterfrom
jordanbull:Feature/flow-control-max-pending
Jul 21, 2021
Merged

Add blocking flow controls to the PubSub Sink connector#282
samarthsingal merged 1 commit into
GoogleCloudPlatform:masterfrom
jordanbull:Feature/flow-control-max-pending

Conversation

@jordanbull

Copy link
Copy Markdown
Contributor

Allowing the flow controls to limit the max outstanding bytes and elements. During large traffic spikes, we have observed Connect playing messages into the PubSub producer client as fast as possible resulting in several GB of off heap usage causing OOM errors. Configuring the connector to block on maxOutstandingRequestBytes should prevent this and stop polling until space is available.

We've tested this both with the default and with a specified low maxOutstandingRequestBytes in our loadtest environment and observed it working as expected.

I've set the default values to Long. MAX_VALUE to effectively preserve the existing behavior for anyone that may not want this change, but I'm open to setting these to a reasonable value if we have some consensus on what that is.

@google-cla

google-cla Bot commented Jun 17, 2021

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@jordanbull

Copy link
Copy Markdown
Contributor Author

@googlebot I signed it!

@google-cla

google-cla Bot commented Jun 17, 2021

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@jordanbull

Copy link
Copy Markdown
Contributor Author

@googlebot I signed it!

@jordanbull jordanbull force-pushed the Feature/flow-control-max-pending branch from dc4bf28 to 4525038 Compare June 18, 2021 00:41
.setDelayThreshold(Duration.ofMillis(maxDelayThresholdMs))
.setElementCountThreshold(maxBufferSize)
.setRequestByteThreshold(maxBufferBytes)
.setFlowControlSettings(FlowControlSettings.newBuilder()

@samarthsingal samarthsingal Jul 21, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we only populate these if the maxOutstandingRequestBytes and maxOutstandingMessages is less than the default otherwise we'll unnecessarily slow down publishing by acquiring/releasing flow controller locks https://github.com/googleapis/java-pubsub/blob/0bba01661c01ca540625f63a0d7e89d43e2dab34/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java#L247-L257.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure

@samarthsingal samarthsingal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for contributing this change! We were in the process of doing this ourselves.

@jordanbull jordanbull force-pushed the Feature/flow-control-max-pending branch from ca0a90b to 390e961 Compare July 21, 2021 19:36
@jordanbull

Copy link
Copy Markdown
Contributor Author

Made the requested changes and did a squash rebase

Comment thread kafka-connector/README.md

@samarthsingal samarthsingal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great, thanks!

Comment thread kafka-connector/README.md
@samarthsingal samarthsingal merged commit 432fda9 into GoogleCloudPlatform:master Jul 21, 2021
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