2

大量查询数据任务,通过 kafka 缓冲后入库,如何解决大任务阻塞小任务的情况。

 2 years ago
source link: https://www.v2ex.com/t/842819
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

大量查询数据任务,通过 kafka 缓冲后入库,如何解决大任务阻塞小任务的情况。

  whats · 22 小时 39 分钟前 · 1215 次点击
RT

每个任务的流程为:查询服务( N 个实例)->kafka 集群( 2 个 topic )->入库服务( N 个实例)->数据库

目前情况:
1. 查询服务从不同来源获取数据,任务数量比较多,1 天任务量可以到 10w 级别
2. 任务查询的数据量差异比较大,有 1 亿条的,少的也就几十条,查询结束前无法提前知道数据量。
3. 单个任务的查询是分批进行的,比如每查 1w 条提交一次给 kafka 的 2 个 topic (少于 1w 条写 topic1,等于 1w 条写 topic2 )。
4. 入库服务消费 2 个 topic ,写入结果库。

遇到的问题:
1. 当有大任务写了大量数据到 kafka 后,一些中小型任务被阻塞,需等大任务入库完成才能入库。

想请教各位大神这类场景有什么策略解决大任务阻塞小任务入库的问题,或者有没其他 mq 替换 kafka ,支持创建大量 topic ,每个任务对应一个 topic ,且不影响 mq 性能。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK