Modern database systems increasingly co-schedule time-sensitive and background tasks. In such mixed workloads, background tasks should ideally utilize only spare CPU capacity without interfering with latency-critical requests. While some database-level solutions address this challenge, many database systems still rely on operating system (OS) schedulers, which, despite supporting priorities, do not reliably isolate high-priority tasks. Furthermore, they remain vulnerable to priority inversion, where preempted background tasks can delay other work. We present UFS, a selectively unfair scheduler implemented as an eBPF-based sched_ext scheduler in the Linux kernel. UFS restricts background tasks to idle CPU capacity and preempts them immediately when time-sensitive tasks arrive. To address priority inversion, UFS incorporates application-level hints via eBPF maps, ensuring that background tasks are not unnecessarily delayed should time-sensitive tasks wait for them to release locks. Our integration of UFS into PostgreSQL demonstrates that, under mixed workloads, UFS improves throughput for time-sensitive tasks by up to 2X, while reducing tail latency by half, compared to existing scheduling options in Linux.
翻译:现代数据库系统日益频繁地同时调度时间敏感型任务与后台任务。在此类混合工作负载中,后台任务理想情况下应仅利用空闲CPU容量,且不干扰对延迟敏感的请求。尽管存在一些数据库层面的解决方案应对这一挑战,但许多数据库系统仍依赖操作系统(OS)调度器,这些调度器即便支持优先级设置,也无法可靠隔离高优先级任务。此外,它们仍容易受到优先级反转(即被抢占的后台任务可能延迟其他工作)的影响。我们提出UFS,一种选择性不公平调度器,在Linux内核中作为基于eBPF的sched_ext调度器实现。UFS将后台任务限制于空闲CPU容量,并在时间敏感型任务到达时立即抢占它们。为解决优先级反转问题,UFS通过eBPF映射集成应用层提示,确保当时间敏感型任务等待后台任务释放锁时,后台任务不会受到不必要的延迟。我们将UFS集成至PostgreSQL的实验表明,在混合工作负载下,与Linux现有调度选项相比,UFS将时间敏感型任务的吞吐量提升高达2倍,同时将尾部延迟降低一半。