-
Notifications
You must be signed in to change notification settings - Fork 69
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
Consumer group not consuming due to multiple k6 init #37
Comments
Hey @timkersch, Thanks for spotting the issue! Could you make a PR with an example script and changes to the README with your experience? It would be much appreciated. 🙏 |
Sure thing, will do it in the next days! :) |
Addressed in 20859bc. |
Hello Mostafa,
|
Hey @nj-apps, Can you provide me with an example script for both cases, so that it can help me reproduce the issue? And how did you figure out that a single VU is consume a single partition in a consumer group? |
Hey @nj-apps, do you still have this issue? |
When using the consumer group feature to subscribe to all partitions in a topic, I got some very strange behaviour where some runs of the code did consume messages and some runs were just stuck and did not get any messages back.
After a lot of debugging I found that k6 runs the init code (code outside of methods) multiple times: https://community.k6.io/t/why-init-called-4-times/973
This caused multiple consumer group instances to be created, which in turn meant that partitions were distributed between them. Thus, sometimes the consumer group created during the last init contained the partitions where my data was, and sometimes it did not contain the right partitions as they were assigned to consumers created in a previous run of init.
I solved this by using a UUID when naming my consumer group, thereby guaranteeing that my consumer group object was assigned to all partitions in a topic.
Although this is not per-se a bug in xk6-kafka, when I followed the documentation here there was no mention of this and the examples all used consumers directly in the init code.
I would suggest to either make this clear in the documentation of somehow alter the code to avoid this problem.
The text was updated successfully, but these errors were encountered: