1 / 32

Cgroup 与单机资源管理

Cgroup 与单机资源管理. 杨毅 yangyi@baidu.com 2011-12. 提纲. 业界声音 Cgroup 实现 Cgroup in Baidu. 提纲. 业界声音 Cgroup 实现 Cgroup in Baidu. Kernel Summit 2011. Cgroup 的发展是 不可逆转 的 Memory Controller ( memcg ) Workshop Google 的云计算平台 OpenVZ 的虚拟计算平台 RedHat 6 和 openSUSE 11.3 Ying Han (Google)

vanna
Download Presentation

Cgroup 与单机资源管理

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Cgroup与单机资源管理 杨毅 yangyi@baidu.com 2011-12

  2. 提纲 • 业界声音 • Cgroup实现 • Cgroup in Baidu

  3. 提纲 • 业界声音 • Cgroup实现 • Cgroup in Baidu

  4. Kernel Summit 2011

  5. Cgroup的发展是不可逆转的 • Memory Controller(memcg) Workshop • Google的云计算平台 • OpenVZ的虚拟计算平台 • RedHat 6和openSUSE 11.3 Ying Han (Google) http://www.programmer.com.cn/9202/

  6. “So I think this is firmly one of those "real improvement" patches. Good job. Group scheduling goes from "useful for some specific server loads" to "that's a killer feature".” Linus Torvalds http://marc.info/?l=linux-kernel&m=128979084506774&w=2

  7. 小补丁 大改善 200+行代码 +config SCHED_AUTOGROUP +bool “Automatic process group scheduling” + select CGROUPS + select CGROUP_SCHED + select FAIR_GROUP_SCHED

  8. 提纲 • 业界声音 • Cgroup实现 • CGROUP与资源管理 • 框架和子系统 • CPU,MEM,NET,IO子系统 • Cgroup in Baidu

  9. Control Groups • Resource Control in Process Groups • Paul Menage (Google) • since linux-2.6.24

  10. 资源 = 硬件 MEMORY NET IO CPU

  11. 进程组更适合作为资源管理的单位  进程组 • 进程 P5 P1 G3 G1 P4 P6 P2 G2 P8 P3 P7

  12. 提纲 • 业界声音 • Cgroup实现 • CGROUP与资源管理 • 框架和子系统 • CPU,MEM,NET,IO子系统 • Cgroup in Baidu

  13. Cgroup细节 • Cgroup框架 • Hierachical • Inherit • Cgroup子系统 • 使用框架的分组机制 • 对一组进程就某种资源进行管理 • Cgroup框架 <-> Cgroup子系统 vfs <-> ext4/btrfs文件系统

  14. Cgroup子系统 • Resource Control • CPU, MEMORY, NET, IO • Isolation and special Control • debug, perf, ns, freezer, devices…

  15. 联合或独立的子系统 • 联合 • 独立 golden cpu: 50% mem: 40%‏ silvercpu: 30% mem: 30% Ironcpu: 20% mem: 30% golden cpu: 50% silvercpu: 30% Ironcpu: 20% golden mem: 40%‏ silvermem: 30% Ironmem: 30%

  16. 提纲 • 业界声音 • Cgroup实现 • CGROUP与资源管理 • 框架和子系统 • CPU,MEM,NET,IO子系统 • Cgroup in Baidu

  17. CPU子系统 • CFS组调度 • cpu.shares • 下限 • 可抢占 • 可稀释

  18. SCHED_AUTOGROUP原理 • firefoxv.s. make-j64 • per-tty/session auto group • user space v.s. kernel space

  19. CPU子系统进展 • 多核 • cpuset:区分cpu core及momory nodes(NUMA) • Pay-per-use环境 • cfs bandwidth control:cpu硬上限

  20. MEMORY子系统 • 限制RSS + Page Cache (+ swap) • 硬上限 • per-group OOM

  21. MEMORY子系统进展 • 隔离性:per-group vm机制 • 更友好的OOM • Kernel memory accounting

  22. NET子系统 • net_cls:基于cgroup的filter • tc:限制发送速率,bps/pps

  23. NET子系统进展 • 用户程序友好 • 接收限速

  24. IO子系统 • dm-ioband • Device mapper layer • 令牌桶,限制带宽 • io-throttle • Generic block layer • 限制iops和带宽 • io-controller • I/O scheduler layer • 按比例分配 service time

  25. IO子系统进展 • service timev.s. iopsv.s. bandwidth • 逻辑设备 v.s. 物理设备 • 隔离对IO调度策略的影响 • 异步支持

  26. 其他子系统 • debug:example debug • ns:名字空间,用于实现container • devices:进程访问设备的黑白名单 • freezer:暂停或重启整组进程 • perf:控制本组进程在特定CPU上的perf_event监控 • checkpoint/restart:进程状态dump到file里,可以在别的机器上重启

  27. 提纲 • 业界声音 • Cgroup细节 • Cgroup in Baidu

  28. Cgroup in Baidu • 上线5000+台服务器,稳定运行12个月 • 单机资源管理框架 • 子系统加强 • 用户态工具封装

  29. Cgroup in Baidu • 场景1:网页检索不停服务更新索引库 • 响应时间灵敏 • 写对读的影响

  30. Cgroup in Baidu • 场景2:分布式计算平台的预算申请与审计 • CPU/MEM更灵活的切分 • 用户程序对平台的影响

  31. Cgroup in Baidu • 场景3:利用线上空闲资源进行代理计算 • 资源的充分利用 • 离线计算对线上模块的影响

  32. Thanks! Q & A

More Related