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

default linger.ms 0 doesn't make sense typically #108

Merged
merged 3 commits into from
Jun 7, 2021

Conversation

ocadaruma
Copy link
Contributor

@ocadaruma ocadaruma commented Jun 7, 2021

Motivation

  • Retry producer will be instantiated with linger.ms = 0 unless we explicitly set, since it's kafka-clients's default.
  • But typically it doesn't make much sense because we don't need such super short delivery latency for retry producer.

Breaking Change

  • A kafka Producer for sending retry tasks are now configured with linger.ms=100 by default, so will introduce some latency in production unless the property is overwritten by the user.

@ocadaruma ocadaruma requested a review from kawamuray June 7, 2021 02:01
// production burst when processes start to fail. (e.g. due to downstream service down)
// Since default producer's linger.ms is 0, this could harm Kafka cluster despite we
// don't much care about retry task's delivery latency typically. So we set reasonable default here.
producerConfig.setProperty(ProducerConfig.LINGER_MS_CONFIG, "100");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you pull this up to somewhere like https://github.com/line/decaton/blob/master/client/src/main/java/com/linecorp/decaton/client/internal/DecatonTaskProducer.java#L42 for ability to easy spot where such defaults are defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about that, but I think making such high linger as the default is only acceptable for retry producers.

But yeah, defining in-line could make spotting the default difficult.
Let me find better way to define defaults for retry producer.

@ocadaruma ocadaruma requested a review from kawamuray June 7, 2021 07:39
@@ -46,6 +48,17 @@
@Setter
@Accessors(fluent = true)
public class SubscriptionBuilder {
private static final Map<String, String> presetProducerConfig;
Copy link
Contributor

Choose a reason for hiding this comment

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

preset*Retry*ProducerConfig?

Copy link
Contributor

@kawamuray kawamuray left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@kawamuray kawamuray merged commit 760ca17 into line:master Jun 7, 2021
@kawamuray kawamuray added the breaking change Breaking change for a public API label Jun 7, 2021
@ocadaruma ocadaruma deleted the retry-producer-default-config branch June 7, 2021 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Breaking change for a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants