-
Notifications
You must be signed in to change notification settings - Fork 127
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
Kafka Observer Sample Pattern #80
Conversation
b433c75
to
c89841a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi team, great job. Based on the on the observer pattern I was able to cut down costs in my sample scenarios by roughly 50% while still staying the acceptable performance ranges for the consumption latency.
Based on the extensive tests that I ran, I suggest a few tweaks and changes in the observer and consumer implementation. Besides some performance tweaks, I would like to revisit the solution design w.r.t. how the observer consumes messages from the topics.
Again, great job!
46e04ef
to
c882b9c
Compare
Introduce kafkadata file Add run.sh Add related Dockerfile's Improve README Signed-off-by: encalada <[email protected]>
Signed-off-by: Karan Kumar <[email protected]> Signed-off-by: encalada <[email protected]>
Signed-off-by: encalada <[email protected]>
Signed-off-by: encalada <[email protected]>
Enhance config fields Signed-off-by: encalada <[email protected]>
Adopt the code to read from the embedded env Vars into our Jobs. Adjust the run.sh script and the README accordingly. Signed-off-by: encalada <[email protected]>
Signed-off-by: encalada <[email protected]>
Signed-off-by: encalada <[email protected]>
- Implement the custom KafkaTopic interface. This allow us to operate on Topics and Consumer Groups offsets. It also uses goroutines and channels, to determine when a change is done in terms of offsets comparisons. We dont longer commit neither read topic messages. - Improve logging - Add missing functions comments - Fixes for job_invoker - Improve handling on env vars for both consumers and observers. - Move images from golang to alpine - Introduce IDLE_TIMEOUT env var Signed-off-by: encalada <[email protected]> Signed-off-by: Mahesh Kumawat <[email protected]> Signed-off-by: encalada <[email protected]>
Co-authored-by: qu1queee <[email protected]> Signed-off-by: encalada <[email protected]>
- when new topic and consumer group - make ticker configurable Co-authored-by: qu1queee <[email protected]> Signed-off-by: encalada <[email protected]>
645139c
to
5fd21fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Great job, team!
While testing, I realized that from time to time one can see large outliers. First I thought this is due to a timing issue in which the observer does not start a new instance because there seems to be still a jobrun around but then the jobrun stops right after and so misses new messages that arrive. However, I can see that in the log below the observer did not noticed new messages sent to message
|
I want to better understand the ticker logic, as I have a concern that there is a bug
You would not always see in the logs the new messages(offset change), due to the ticker. But the latest offset change being logged should reflect the change from all previous arrived messages. This is ok, as long as a Jobrun was already running. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This introduces a Kafka Observer Pattern for consumes a stream of messages from Kafka.
A so called Observer entity is provided, this Observer has the task to consume messages from multiple Kafka Topics and wake-up the so called Consumers whenever new messages arrived.
Consumers are the second entity in this sample. They will consume messages from a particular Kafka Topic after being wake-up by the Observer. Note that users might bring their own Consumer Kafka Clients code. In this example, a Consumer client written in go is provided. Consumers will gracefully shut-down after one minute, if no new messages are coming through the stream.
A comprehensive README is provided, on how to use this sample.