Scheduling Service 如何从 JobSchedulesTable 选取到期任务并推入队列?为什么需要按 next_run_time 分区或索引?
How does the Scheduling Service select due jobs from JobSchedulesTable and push them to the queue? Why partition or index by next_run_time?
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: medium
分类: system-design, scheduling
标签: scheduler, next_run_time, partitioning, indexing, job-queue
参考答案摘要
TL;DR Scheduling Service 会周期性(例如每分钟)查询 schedules 表中 next_run_time 等于当前时间片的记录,将到期任务推入分布式队列,并将 Job Table 状态更新为 SCHEDULED 。由于查询的过滤条件是 next_run_time ,应按该列进行分区或建立索引,以便高效检索某一分钟内的所有任务。 示例查询 SELECT * FROM Job...
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。