Scheduler: Linux Versus FreeBSD
最近發生的事,經過可以參考 lkml 上的 Performance versus FreeBSD 7.0 以及 lwn 上的討論。
在 FreeBSD 7.0-RELEASE Announcement 中提到了:
# Dramatic improvements in performance and SMP scalability shown by various database and other benchmarks, in some cases showing peak performance improvements as high as 350% over FreeBSD 6.X under normal loads and 1500% at high loads. When compared with the best performing Linux kernel (2.6.22 or 2.6.24) performance is 15% better. Results are from benchmarks used to analyze and improve system performance, results with your specific work load may vary. Some of the changes that contribute to this improvement are:
* The 1:1 libthr threading model is now the default.
* Finer-grained IPC, networking, and scheduler locking.
* A major focus on optimizing the SMP architecture that was put in place during the 5.x and 6.x branches.
Some benchmarks show linear scaling up to 8 CPUs. Many workloads see a significant performance improvement with multicore systems.
在這份 pdf 的第 18 和 19 頁中有實際測試的結果,在總共有八核的系統上用 sysbench 來量測,FreeBSD 7.0 SCHED_ULE > Linux 2.6.22 > Linux 2.6.23,其中 2.6.22 使用的是舊的 scheduler,2.6.23 開始改成使用 CFS。
Nick Piggin 重新做了一次測試,結果和上面的結果完全不同,Linux 2.6.24 小勝 FreeBSD 7.0 SCHED_ULE。為了測試 CFS 的影響,後來又補測了 2.6.22,2.6.22 依然小勝 FreeBSD 7.0 SCHED_ULE,而 CFS 的表現比舊有的 scheduler 好,但是在 process 數目增加時,舊的 scheduler degrade 的速度比較慢。
不過我總覺得如果效能沒有相差太多的話,其實這些測試都看看就好了… ![]()