Pages

Tuesday, February 18, 2020

Kafka F.A.Q

In here a few questions around Kafka that may appear on interviews. As I will collect more, I will add them to this post. Other Java related interview questions, can be found here:
http://javing.blogspot.com/2018/12/java-developer-interview-questions.html

In the context of Kafka, what does back pressure mean?
It means that a slow consumer should be capable of handling throughput coming from a fast producer.

Do you know any solution(other than increasing partitions) to deal with consumers back pressure? 
- Increasing partitions
- The consumer signals to the producers that they are sending the data to fast(reactive streams can do this)
- Buffering 

Name one advantage and one disadvantage of Kafka?
advantage: using Kafka can reduce the amount of integrations needed in a large ecosystem of applications. This reduction of integrations often results operational cost savings for the company.
disadvantages

disadvantage: order in which events arrived in a multiple partitions scenario is not guaranteed. Using timestamps can help consumers understand the order. If the cluster is being distributed across different time-zones, the event may also need to carry some sort of unique identifier so that alongside the timestamp, the consumer can understand the order. 

Can race conditions happen in Kafka and how can we prevent them?
Race conditions with Kafka consumers can happen and one of the main reasons is that in multi partition scenarios, the order of the events is not guaranteed. In order to guarantee ordering timestamps and/or unique identifiers is needed.

No comments:

Post a Comment

Share with your friends