-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
KafkaJs consumer taking longer time if keeping groupID same #807
Comments
I don't see that you posted your
Typos: It's "kafka", not "kafak" :) |
#701 probably related. Most likely the reason for slow connection is due to session timeout as if you disconnect from CG it may take some time for server to expire your previous connection. Also i noticed that |
Thank @ankon and @goriunov for you view on the code. Yes i have corrected it and now now calling the consumer on-time only and that's help and now my response time for first and followed message is Current Stat @ankon However, needed your view on the procedure as well. The code base for procedure is ( currently procedure creating the inbound and outbound topic automatically such that other side scheduler will pick the message from inbound topic and put response from into outbound topic and from where our consumer (above
one observation we found when we are start sending the 10K+ message in 3 seconds at few (30%) message are available after 1 min and because of same the TAT getting impacted. Kindly suggest Thanks. |
I have the same problem when using nodemon for debugging. And it may be the same with 260#
And when it restarts, it outputs:
It shows that consumers indeed disconnected. But consumers still taking a long time to connect if keeping the same groupID, exactly it seems like the
It doesn't occur if I use a different groupID or use |
What you need to keep in mind is that the consumer group exists outside of your node instances. Whenever a consumer joins or leaves the group, all the members of the group have to re-join and sync before they can start consuming again. When you start your node process, your consumer will join that consumer group, and when you quit the process (with graceful disconnect), your consumer will leave the consumer group. Like mentioned above, this means the group has to rebalance (re-join and sync). When you just exit the process without disconnecting, your consumer doesn't actually leave the group - so initially there won't be a rebalance. However, after If you are developing with nodemon, causing frequent restarts, a solution is probably to generate a random groupid on each restart. When static membership (#884) becomes available, that could be another option, but it's not available yet so for now a random group id is probably the best bet. Either that, or you have to wait for the rebalance to happen. |
Thanks for your explanation~ I still have a question, I add |
It will take up to
|
yeah, I get it, how about I set this value to less than 10000, any side effects will be made? I know this option but no detailed description in the documentation. |
It's pretty important that you understand how This talk https://www.confluent.io/online-talks/everything-you-always-wanted-to-know-about-kafkas-rebalance-protocol-but-were-afraid-to-ask-on-demand explains everything very well. There are also loads of other resources on the internet explaining this. |
Hi Nevon, After several weeks I'm working on this problem again, since random group id will bring to some questions we don't expect. eg. with different consumer group id, our new consumer may consume the same message again that the old consumer has consumed. I am confused about
It shows in the log that the consumer indeed stopped:
Is this graceful disconnecting? But in the Kafka server, I still see that the consumer was kicked out after session timeout.
Does it mean that consumer.disconnect doesn't work? Thanks in advance. |
If you enable debug logs, you can see exactly what happens. What should be happening is that the consumer(s) wait for ongoing work, send a |
Yes, I see it like this:
I wonder why the Kafka server still kicked out the consumer after session timeout, even if I disconnect the consumer when the process exits. From your explanation above, I think it may not normal. |
I believe I am facing a similar issue to this. Is there any update on the fix? Based on #701 it seems that this is a known issue, and the workaround for now is to use different groupIds. Is that correct? |
@sidyag I faced the same issue in e2e tests. |
Hi, |
Have the same issue with the NestJs Kafka application, reconnect to Kafka takes 15-30 sec when I'm using hot reload, this is really annoying while developing an app. My app gracefully disconnects from Kafka and then connects... |
So how did you solved? |
Unfortunately didn't find a solution yet :( |
Hi Team,
we are facing the same issue, however time remain unpredictable.
As we are using the same code KafkaJS in the production environment, so this is not possible to change the consumer groupID after each call, it must kept same to make make sure that we can read only those message which was not read from the groupID, if we keep changing the groupID on each request/interval then we will always getting the all message again and again, yes this improvement connection and message getting time like anytime.
Current Stat
Keeping same consumer group ID: 20-30 Seconds
Keep changing the groupID: 2-5 mili second
here we are looking for your help, how to improve the connection time and message fetching keeping consumer groupID same
my code base is.....
.env
DEFAULT_MESSAGE_POLLING_TIME=700
KAFAK_BROKER_ENDPOINT=localhost:9094
KAFAK_OUTBOUND_TOPIC_PREFIX=
KAFAK_OUTBOUND_TOPIC_POSTFIX=_OUT
I have set the consumer group name and topic name in the Database, in this case
consumer_group_name = "customer_demo_group"
outbound_topic = "customer_demo_OUT"
and consumer code base is
and we expecting 0.1-0.2 billions of message in the 15 min time to be get consumer and send to the requester
@tulios @Nevon Kindly assist
Originally posted by @jaiswarvipin in #260 (comment)
The text was updated successfully, but these errors were encountered: