-
Notifications
You must be signed in to change notification settings - Fork 663
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
[Knowledge gathering question] Best practices to set up Producer clients for multiple topics #1310
Comments
I found this issue in librdkafka It seems that if I have different producer configurations for different topics using one producer client for multiple topics does not set the different values. Example:
I set the Output:
However, if I use multiple producers for multiple topics, per-topic configurations are respected.
|
Description
Hello 👋
I am seeking guidance on the best practices to set up producer clients for multiple topics.
My current setup is that when my server boots up I create producer clients for each topic.
So, if my server wants to publish to 1...N number of topics then I create 1...N number of clients.
While theoretically, N can be any positive number in practice (in my case), it can be between 1~10.
I create the producers when the app boots up (during dependency injection). The producers are alive
throughout the app lifecycle. During the application shutdown, I close the producers after flushing them.
The reason I don't create a producer per message is because of the high latency of producer client creation and
then sending the message.
The motivation for creating one producer client for each topic is to provide isolation among the clients.
If one client gets impacted due to any reasons (for example, messages larger than 1MB are being published
for one topic so Kafka rejects it, but the other clients can continue to publish messages for other topics)
Some downsides of having multiple producer clients for multiple topics I can think of are as follows:
redundant TCP connections to Kafka: since all producer clients are connected to all broker nodes, I have a redundant TCP connection. I am assuming that this take redundancy takes some space in the application heap memory.
Could you please suggest guidance if the above approach is ok? If not could you please give me a pointer
for the best approaches?
How to reproduce
Checklist
Please provide the following information:
LibraryVersion()
): 2.4.0ConfigMap{...}
"debug": ".."
as necessary)The text was updated successfully, but these errors were encountered: