admin管理员组文章数量:1391934
I created a Kafka stream-based application that performs processing (whatever it is) on files. The application basically receives "in real time" messages in a topic, and every message contains the path of one file that must be "processed".
The problem I'm struggling with is that the "processing" of a file takes some variable time (let's say between a couple of seconds and up to one minute for big and complex files), and relies on limited resources (concretely, it requires connection to an external datasource and the connection pool to this datasource has a fixed "S" size I cannot change)
This means that I would like my stream consumer only consumes "batches" of "S" messages, processes them (I would be sure not to exceed the connection pool with my external datasource), and once all of them have been processed, carry on with messages consumption. To sum up, whatever the speed of message production on one side, I would like to limit the messages consumption in my application to comply with the size of the connection pool.
I know that it will impact the lag of messages (that would stay in the topic until the consumer is ready to process them), but this is not critical to me, I just want to process the messages as fast as I can, not as fast as they are produced...
Does it seem feasible to you or is it bad idea/design ? Thanks for your feedback/advices
本文标签:
版权声明:本文标题:performance - How to restrict kafka stream messages consumption (to avoid external resource starvation) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744707447a2620926.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论