Linux Docker MessTechnologies in Docker 可配额/可度量 Control Groups (cgroups) cgroups 实现了对资源的配额和度量。cgroups 提供类似文件的接口,在/cgroup目录下 新建一个文件夹即可新建一个group,在此文件夹中新建task文件,并将pid写入该文件, 即可实现对该进程的资源控制。groups可以限制blkio、cpu、cpuacct、cpuset、devices、 等。 cpu 这个子系统使用调度程序为cgroup任务提供cpu的访问。 cpuacct 产生cgroup任务的cpu资源报告。 cpuset 如果是多核心的cpu,这个子系统会为cgroup任务分配单独的cpu和内存。 devices 允许或拒绝cgroup任务对设备的访问。 freezer 暂停和恢复cgroup任务。 memory 设置每个cgroup的内存限制以及产生内存资源报告。 net_cls net_cls 标记每个网络包以供cgroup方便使用。 ns 名称空间子系统。 Refer to: https://www.kernel.org/doc/Documentation/cgroups/ Technologies in Docker 典型Linux启动运行需要两个FS:bootfs + rootfs bootfs (boot file system) 主要包含bootloader和kernel,0 码力 | 77 页 | 7.40 MB | 1 年前3
微服务容灾治理⽽容器⾥⼜分为 cgroup v1 和 cgroup v2 ,所以总的有三类需要处理: • 虚机(不同云⼚商有不同的叫法,⽐如ECS,EC2等) • 容器cgroupv1 • 容器cgroupv2 这⾥有个特别需要关注的点是:容器是否设置了 cpu limit ,如果没设,就只能⽤可以调度的cpu 个数来计算,⽐如 cgroup v2 ⾥可以读取 ⾥可以读取 /sys/fs/cgroup/cpuset.cpus.effective ⽂ 件。 这⾥详细读取 cgroup 和 /proc 下⽂件的⽅法我就不细述了,详⻅go-zero代码。 3.1.2CPU使⽤率计算⽅法(以 cgroup v2 为例) 3.1.2.1实时CPU使⽤率的计算 • ⽅法⼀ • ⽅法⼆ go-zero使⽤了⽅法⼀,因为我考虑到0 码力 | 13 页 | 1.68 MB | 1 年前3
美团点评2018技术年货PU、内存等资源需要做一定的限制。 这就是Cgroup技术,Cgroup是Control group的意思。比如我们常说的4c4g的容器,实际上是限制这个 容器namespace中所用的进程,最多能够使用4核的计算资源和4GB的内存。 简而言之,Linux内核提供namespace完成隔离,Cgroup完成资源限制。namespace+Cgroup构成了容 器的底层技术(rootfs是容器文件系统层技术)。 是统一返回主机的内存信息,如果容器内的应用,按照它发现的宿主机内存来进行配置的话,实际资源是 远远不够的,导致的结果就是:系统很快会发生OOM异常。 我们做的隔离工作,是在容器中获取内存信息时,内核根据容器的Cgroup信息,返回容器的内存信息 (类似LXCFS的工作)。 美团容器平台架构及容器技术实践 - 美团技术团队 CPU信息隔离的实现和内存的类似,不再赘述,这里举一个CPU数目影响应用性能例子。 IO缓存隔离和限速在Linux 4.X里通过 Cgroup V2实现,有了明显的改进,我们还借鉴了Cgroup V2的思想,在我们的Linux 3.10内核实现了相 同的功能:每个容器根据自己的内存配置有对应比例的IO Cache,Cache的数据写到磁盘的速率受容器 Cgroup IO配置的限制。 Docker本身支持较多对容器的Cgroup资源限制,但是K8s调用Docker时可以传递的参数较少,为了降低0 码力 | 229 页 | 61.61 MB | 1 年前3
基于Rust-vmm实现Kubernetes运行时We Have Done 1. Hardware Isolation 2. Security Tools - SELinux, Seccomp, AppArmor, Capabilities, Cgroup 3. Intrusion Detection - Monitor suspicious read/write to host files. For example, container Software Bullet Point Rule-based Sandbox RunC Needs to work with SELinux, AppArmor, Seccomp, cgroup VM-based Sandbox Kata-container BareMetal Only Heavy control logic Application kernel based Sandbox0 码力 | 27 页 | 34.17 MB | 1 年前3
2022年美团技术年货 合辑服务质量保障:实时监控负载指标,依据资源池的优先级管理策略,在 资源竞争的情况下,通过资源抢占、服务降级及驱逐等多种手段分优先级保 障服务质量。 ● 资源配置管理模块:基于各资源池的配置,通过 Cgroup 等系统工具,对不同 资源池的资源进行隔离与限制。 ● 资源上报模块:周期 Patch 节点的资源使用情况、资源池负载等信息。 978 > 2022年美团技术年货 图 4 QoSAdaptor 行为,根据优先级对部分容器进行资源降级,保障池内绝大多数容器的稳定性。 ● 容器驱逐:Kubernetes 原生的驱逐策略基于整个节点的负载,LAR 中将策略 缩小到了资源池维度,当池内 Memory 使用接近 Cgroup 限制,避免整个资 源池出现 OOM,影响所有容器的正常运行,会结合优先级筛选 Memory 使用 较多的容器进行驱逐操作。 ● CPU 降级:池内 CPU 负载超过一定负载等级,避免高负载导致的容器间互相 数据平台做了哪些优化。首先从宏 观层面,我们将受影响因素分为应用层和系统层,然后详细介绍应用层和系统层存 在的问题,并给出对应的解决方案,包括流水线加速、Fetcher 隔离、迁移取消和 Cgroup 资源隔离等,下面具体介绍各种优化方案的实现。 2.1 概览 图 2-1 Kafka 读写延迟优化概览 1196 > 2022年美团技术年货 图 2-1 是针对读写延迟碰到的问题以及对应优化方案的概览图。我们把受影响的因0 码力 | 1356 页 | 45.90 MB | 1 年前3
Conan 1.56 Documentation_cpu_count(). _cpu_count() reads cgroup to detect the config- ured number of CPUs. Currently, there are two versions of cgroup available. In the case of cgroup v1, if the data in cgroup is invalid, processor detection build_jobs() will safely return 1. In the case of cgroup v2, if no limit is set, processor detection is used. When the limit is set, the behavior is as described in cgroup v1. Parameters: • conanfile: The current If processor detection is not enabled, it will safely return 1. When running in Docker, it reads cgroup to detect the configured number of CPUs. It Can be overwritten with the environment variable CONAN_CPU_COUNT0 码力 | 963 页 | 7.67 MB | 1 年前3
Conan 1.51 Documentation_cpu_count(). _cpu_count() reads cgroup to detect the config- ured number of CPUs. Currently, there are two versions of cgroup available. In the case of cgroup v1, if the data in cgroup is invalid, processor detection build_jobs() will safely return 1. In the case of cgroup v2, if no limit is set, processor detection is used. When the limit is set, the behavior is as described in cgroup v1. Parameters: • conanfile: The current If processor detection is not enabled, it will safely return 1. When running in Docker, it reads cgroup to detect the configured number of CPUs. It Can be overwritten with the environment variable CONAN_CPU_COUNT0 码力 | 933 页 | 7.58 MB | 1 年前3
Conan 1.52 Documentation_cpu_count(). _cpu_count() reads cgroup to detect the config- ured number of CPUs. Currently, there are two versions of cgroup available. In the case of cgroup v1, if the data in cgroup is invalid, processor detection build_jobs() will safely return 1. In the case of cgroup v2, if no limit is set, processor detection is used. When the limit is set, the behavior is as described in cgroup v1. Parameters: • conanfile: The current If processor detection is not enabled, it will safely return 1. When running in Docker, it reads cgroup to detect the configured number of CPUs. It Can be overwritten with the environment variable CONAN_CPU_COUNT0 码力 | 943 页 | 7.62 MB | 1 年前3
Conan 1.53 Documentation_cpu_count(). _cpu_count() reads cgroup to detect the config- ured number of CPUs. Currently, there are two versions of cgroup available. In the case of cgroup v1, if the data in cgroup is invalid, processor detection build_jobs() will safely return 1. In the case of cgroup v2, if no limit is set, processor detection is used. When the limit is set, the behavior is as described in cgroup v1. Parameters: • conanfile: The current If processor detection is not enabled, it will safely return 1. When running in Docker, it reads cgroup to detect the configured number of CPUs. It Can be overwritten with the environment variable CONAN_CPU_COUNT0 码力 | 953 页 | 7.64 MB | 1 年前3
Conan 1.54 Documentation_cpu_count(). _cpu_count() reads cgroup to detect the config- ured number of CPUs. Currently, there are two versions of cgroup available. In the case of cgroup v1, if the data in cgroup is invalid, processor detection build_jobs() will safely return 1. In the case of cgroup v2, if no limit is set, processor detection is used. When the limit is set, the behavior is as described in cgroup v1. Parameters: • conanfile: The current If processor detection is not enabled, it will safely return 1. When running in Docker, it reads cgroup to detect the configured number of CPUs. It Can be overwritten with the environment variable CONAN_CPU_COUNT0 码力 | 953 页 | 7.65 MB | 1 年前3
共 65 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7













