I am currently implementing a server program that forks a process to handle a client's request. The forked process must be well-controlled in terms of cpu, memory, disk, and other system attributes. I noticed the easiest way to implement a resource manager class is to wrap around C rlimit
. However, rlimit
seems too basic. I was informed modern software technology such as cgroups
and LXC
can also do good jobs. In my applications, the forked processes must communicate with each other, either through local shared memory or remote network socket (the application runs on a machine cluster). In this case, is cgroups
or LXC
affordable? I noticed that a container is fully isolated and cannot talk to each other. Any comments will be appreciated!
Asked
Active
Viewed 346 times
0

Jes
- 2,614
- 4
- 25
- 45
-
What I understand from your question is the necessity to control resource utilization of your forked processes. Should you use containers for each forked process? I don't think so. What you can do is to create a `'lxc` container that runs the root parent server instance and forks new processes on new client requests. Now, each of those newly forked processes' resources can be control through `/sys/fs/cgroup/` filesystem. – Monku Oct 10 '16 at 20:01
-
But you have to first reason the need to create `lxc` container for your root server instance. Are you going to run different servers on your machine ? If no, then you are better off running the root server instance on your host execution without `lxc` and still be able to control forked processes' resource utilization using `cgroup` filesystem – Monku Oct 10 '16 at 20:03
-
This link should help you with `cgroup` workings https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt – Monku Oct 10 '16 at 20:06