最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

performance - How to restrict kafka stream messages consumption (to avoid external resource starvation) - Stack Overflow

programmeradmin0浏览0评论

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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论