cgroups

Limit CPU time of process group

柔情痞子 提交于 2019-12-23 01:54:17
问题 Is there a way to limit the absolute CPU time (in CPU seconds) spend in a process group? ulimit -t 10; ./my-process looks like a good option but if my-process forks then each process in the process group gets its own limit. The whole process group can use an arbitrary amount of time by forking every 9 seconds. The accepted answer on a similar question is to use cgroups but doesn't explain how. However, there are other answers (Limit total CPU usage with cgroups) saying that this is not

LXC without chroot

北慕城南 提交于 2019-12-18 11:32:30
问题 Is there any way to use LXC for resource management using process groups without creating containers? I am working on a service that runs arbitrary code inside a sandbox, for which I am only interested in hardware resource management. I don't want any chrooting; I just want these process groups to have access to the main file system. I was told that lxc is light weight, but all the examples that I see create a new container (I.e. a dir with a full OS) for every lxc process. I don't really see

Android Process Scheduling

丶灬走出姿态 提交于 2019-12-17 08:12:20
问题 I am trying to get a better understanding so I can scope the reliability impact from potential interoperability issues when creating an android app/service. I would like to figure out how process priority is determined. The differences in priority between services and activities and if the scheduler treats their priority differently. Basically I'm trying to get a strong understanding of how likely it is that an activity or service is starved by a rogue processes from a different application

Android Process Scheduling

寵の児 提交于 2019-12-17 08:12:12
问题 I am trying to get a better understanding so I can scope the reliability impact from potential interoperability issues when creating an android app/service. I would like to figure out how process priority is determined. The differences in priority between services and activities and if the scheduler treats their priority differently. Basically I'm trying to get a strong understanding of how likely it is that an activity or service is starved by a rogue processes from a different application

How to enable CONFIG_RT_GROUP_SCHED in Ubuntu to make it RT

主宰稳场 提交于 2019-12-11 08:33:08
问题 I need to run real time applications on Ubuntu RT Linux and was reading about ways to make linux act as RT system and I learned two ways to do it preemptive_rt kernel patching enabling CONFIG_RT_GROUP_SCHED flag in the kernel. I've already tried my hands on 1st method Install RT Linux patch for Ubuntu However, apart from uname -r showing #1 SMP PREEMPT RT I've no other proof that it is actually a RT system and hence want to try the 2nd method. Enable CONFIG_RT_GROUP_SCHED flag in the kernel

Mounting cgroups for Resource Management in Docker

时光怂恿深爱的人放手 提交于 2019-12-11 07:33:14
问题 This is in reference to https://docs.docker.com/config/containers/resource_constraints/#limit-a-containers-access-to-memory. I have already created working containers, running Docker version 18.05.0-ce on a Raspberry Pi (64-bit) using Raspbian Jessie Lite (essentially GUI-less Debian Jessie). The documentation claims that you can just pass memory/cpu flags on the docker run command. But when I try something like docker run -it --name test --memory=512m container_os , it says: WARNING: Your

Limit total CPU usage with cgroups

自闭症网瘾萝莉.ら 提交于 2019-12-08 15:42:33
I have a script which uses ulimit -t 5 to limit a program to 5 seconds of CPU time. That program now spawns children, so I want to use cgroups instead, so I can limit the CPU taken by the process, and it's children. However, I can't find a way of placing a hard upper limit on a cgroup's CPU usage. Cgroups won't kill the process for you, but it will limit its runtime per specific period. You can use a very long period for cpu.cfs_period_us and check the cgroup task list after that period. If the tasks are still running, then kill them manually using: kill -9 $(cat /sys/fs/cgroup/.../tasks) cpu

Limit total CPU usage with cgroups

╄→гoц情女王★ 提交于 2019-12-08 04:48:15
问题 I have a script which uses ulimit -t 5 to limit a program to 5 seconds of CPU time. That program now spawns children, so I want to use cgroups instead, so I can limit the CPU taken by the process, and it's children. However, I can't find a way of placing a hard upper limit on a cgroup's CPU usage. 回答1: Cgroups won't kill the process for you, but it will limit its runtime per specific period. You can use a very long period for cpu.cfs_period_us and check the cgroup task list after that period.

Using Cgroups to limit cpu usage

▼魔方 西西 提交于 2019-12-04 10:33:30
问题 I am trying to use cgroups in order to limit the CPU usage. I am using this guide https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/sec-cpu_and_memory-use_case.html My /etc/cgconfig.conf file is the following mount { cpu = /mnt/cgroup/cpu,cpuacct; cpuacct = /mnt/cgroup/cpu,cpuacct; } group wheel { cpu { cpu.shares="800"; } cpuacct { cpuacct.usage="0"; } } group test1 { cpu { cpu.shares="200"; } cpuacct { cpuacct.usage="0"; } } My cgrules

磁盘优化思路

怎甘沉沦 提交于 2019-12-04 10:27:18
磁盘优化思路 性能定位套路 和之前类似,我们不可能出现性能问题就把所有工具都跑一遍,而是先运行那几个支持指标较多的工具,如 top,iostat,vmstat等来缩小范围 先用top, iostat 发现磁盘 I/O 性能瓶颈; 再借助 iotop, pidstat 等定位出导致瓶颈的进程; 随后用strace, lsof等分析进程的 I/O 行为; 最后,结合应用程序的原理,分析这些 I/O 的来源。 性能优化思路 由于影响磁盘I/O性能的因素众多,我们对磁盘I/O优化分应用程序,文件系统,磁盘三方面来说 1.应用程序优化 应用程序处于整个 I/O 栈的最上端,它可以通过系统调用,来调整 I/O 模式(如顺序还是随机、同步还是异步), 同时,它也是 I/O 数据的最终来源。 在我看来,可以有这么几种方式来优化应用程序的 I/O 性能: 1).可以用追加写代替随机写,减少寻址开销,加快 I/O 写的速度。 2).可以借助缓存 I/O ,充分利用系统缓存,降低实际 I/O 的次数。 3).可以在应用程序内部构建自己的缓存,或者用 Redis 这类外部缓存系统。这样,一方面,能在应用程序内部,控制缓存的数据和生命周期;另一方面,也能降低其他应用程序使用缓存对自身的影响。 4).在需要频繁读写同一块磁盘空间时,可以用 mmap 代替 read/write,减少内存的拷贝次数。 5)