-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Async/Batched Producer #18
Comments
I think we need it!!! |
Brain dump for reference, more thought is needed: Thought about this a bit, it doesn't seem as simple as I'd hoped (depending on the tradeoffs you want to make). The biggest decision to make is how to handle errors: the simplest way is an async errors channel the user can select on, but then the user can't really act on the errors they see. There's no easy way for them to associate errors with a particular message (or set of messages, since this is batching), and even if there were they may have submitted more messages in the meantime, so resubmitting the failed ones would lead to (potentially severe) out-of-order scenarios. A call-me-on-error callback is more complicated but perhaps more powerful and flexible, especially combined with a set of possible commands that the callback could return (retry/requeue/discard/abort are possibilities that come to mind). Barring that complication (however we solve it), I think the basic architecture can be:
The The manager goroutine, in addition to dispatching messages, also has to manage (create/delete) the sending goroutines as brokers go up and down, leadership elections happen etc. If a batch of messages is sent to a broker which is no longer the leader for their partition, that sending goroutine has to pass those messages back to the manager to be redispatched to whatever the new broker is leading that partition. |
#41 was merged, effectively fixing this. There is still much cleanup to do, but this can be closed. |
Some config options (similar to the Java/Scala producer) for collecting and batching messages rather than sending each produced message immediately. This will be more efficient, and will make compression much more efficient as well.
The text was updated successfully, but these errors were encountered: