I built a kafka application with java having:
- a producer producing records to kafka
- a kafka stream consuming these records, applying some (time windowed and with a state store) operations on its values and sending them back to kafka
- a consumer consuming these transformed values and writing them into a database
I am measuring time differences between the kafka timestamps of the producer record (which gets consumed by the kafka stream) and the consumer record (which gets consumed by the consumer). So basically when the producer record gets created and when this record is transformed by the stream and sent back to kafka. In the end I take the average of each time difference in my database.
For any reason this time difference increases when I add more streaming nodes and more partitions to my topic. I actually expected the time difference to decrease. Now I am wondering if I am doing something wrong or if it can happen that by increasing the number of nodes the data processing takes a longer amount of time.
In the end my question is: Is it possible that the data processing takes longer by adding more nodes to kafka? If so, what could be the reasons?