> On June 6, 2016, 10:15 p.m., Qian Zhang wrote:
> > src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp, lines 79-80
> > <https://reviews.apache.org/r/46158/diff/2/?file=1347650#file1347650line79>
> >
> >     So we create subsystem for each container, suppose 
> > `"--isolation=cgroups/mem"` and there are 100 containers created in an 
> > agent, we will create 100 `MemorySubsystem` objects, right? It is a bit 
> > overhead since the only differences between these 100 objects are just 
> > `"containerId"` and `"cgroup"`. Can we only create one subsystem object for 
> > each enabled subystem specified in `"--isolation"` and reuse it for all the 
> > containers?

More thinkings: Instead of creating subsytem objects (e.g., `new 
MemorySubsystem`) in `CgroupsIsolatorProcess::Info::create()`, I think maybe we 
can create only ONE subystem object for each subsystem in 
`CgroupsIsolatorProcess::create()`, e.g., if the agent is started with 
`--isolation=cgroups/mem,cgroups/net_cls`, then we create 2 subsystem objects 
for `MemorySubsystem` and `NetClsSubsystem` respectively in 
`CgroupsIsolatorProcess::create()`, these two subsystem objects will be 
responsible for all the containers in the agent.

In the class `Subsystem`, we can introduce a static member `static 
hashmap<ContainerID, process::Owned<Info>> infos;` which will be shared by all 
the subsystem objects we created in `CgroupsIsolatorProcess::create()` and 
introduce a static method `static void Subsystem::addInfo(...)`, and then in 
`CgroupsIsolatorProcess::prepare()`, we create an `Info` object for the 
container, call `Subsystem::addInfo()` to add the `Info` object into 
`Subsystem::infos`, and then call the `prepare()` method of each subsystem 
object.

In this way, we only need to create one subsystem object which can handle all 
the containers in the agent. And another benefit is, the following members do 
need to be static anymore:
```
NetClsSubsystem::handleManager
PerfEventSubsystem::handleManager
```


- Qian


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46158/#review136250
-----------------------------------------------------------


On April 16, 2016, 6:14 p.m., haosdent huang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46158/
> -----------------------------------------------------------
> 
> (Updated April 16, 2016, 6:14 p.m.)
> 
> 
> Review request for mesos, Gilbert Song, Guangya Liu, Ian Downes, Jie Yu, and 
> Kevin Klues.
> 
> 
> Bugs: MESOS-5041
>     https://issues.apache.org/jira/browse/MESOS-5041
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Completed implementation of the cgroups unified isolator.
> 
> 
> Diffs
> -----
> 
>   src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/46158/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> haosdent huang
> 
>

Reply via email to