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

Producer will persistently consume the memory via produce_no_ack #485

Open
belltoy opened this issue Jan 5, 2022 · 4 comments
Open

Producer will persistently consume the memory via produce_no_ack #485

belltoy opened this issue Jan 5, 2022 · 4 comments

Comments

@belltoy
Copy link
Contributor

belltoy commented Jan 5, 2022

When producing via produce_no_ack(fire & forget), and if the Kafka broker response is slower than producing, the producer will persistently consume the memory till OOM.

https://github.com/kafka4beam/brod/blob/master/src/brod_producer_buffer.erl#L118

It's better to add a threshold to limit that. Or drop messages when exceeding.

@zmstone
Copy link
Contributor

zmstone commented Jan 5, 2022

Hi @belltoy

The API is designed to be async without back pressure.

maybe a configurable behavior:

  • By default, keep the current behavior (backward compatible)
  • Punishing (block) callers when buffer is full (this will need caller to use a different api)
  • drop new no-ack requests if buffer is full (can’t drop old because otherwise we’d have to scan the buffer)

@zmstone
Copy link
Contributor

zmstone commented Jan 5, 2022

A quick fix for you is maybe to make the caller alternatively use produce_no_ack and produce_sync
e.g. call produce_sync once for every 100 produce_no_ack.

@belltoy
Copy link
Contributor Author

belltoy commented Jan 5, 2022

Yes, I saw that's what this API was designed for. But need some method to handle this.

drop new no-ack requests if buffer is full (can’t drop old because otherwise we’d have to scan the buffer)

This idea maybe fit my scenario. But where to drop these requests?

The ack/no_ack term of this API is different from the acks term of Kafka, which is confusing. Or rather to say, like cast in Erlang. In the meanwhile, Kafka protocol acts a request/response model, except produce requests with RequiredAcks=0. There must be a response to a produce request, no matter what the required_acks is if RequiredAcks != 0.

People don't care about acks/response/others in this scenario, use acks=0, which means, produce/write if you can, or drop if not. But do not block/punish me.

EDIT: Produce request with RequiredAcks=0 is the only case where the server will not reply to.

@zmstone
Copy link
Contributor

zmstone commented Jan 5, 2022

This idea maybe fit my scenario. But where to drop these requests?

This is an enhancement to be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants