[lxc-users] Does cpu cgroup has been enabled in lxc/lxd

kemi kemi.wang at intel.com
Mon Nov 5 05:12:35 UTC 2018



On 2018/11/2 下午8:05, Fajar A. Nugraha wrote:
> On Fri, Nov 2, 2018 at 8:44 AM, kemi <kemi.wang at intel.com> wrote:
> 
>>
>> thx for your question.
>> In our case, our customers want to run android games within containers on
>> cloud.
>>
> 
> It might be possible for you to adjust https://anbox.io/ to run on lxd
> instead of lxc. YMMV.
> 

anbox provides a GUI interface to run android in container.
We don't need that GUI which leads to extra overhead. Also,
Anbox can't offer thousands of containers running in parallel.

> There are two problems we have known.
>> The first one occurs during Android OS boot, the coldboot of Android
>> requires to
>> write uevent file in /sys, this will trigger an uevent broadcast to all of
>> listeners
>> (udev daemons) in user space (this uevent is sent from kernel via
>> netlink),
>> with the increase of container number (200+), we found the boot latency
>> has
>> reached 1~2 mins. And latency would be intolerable when the number reaches
>> 500.
>>
>>
> I don't see udev running inside it's lxc container, so perhaps they've
> managed to solve that issue
> 

root at kemi-desktop:/home/kemi/git# lxc list                                                                                                                                                                  
+--------+---------+---------------------+------+------------+-----------+
|  NAME  |  STATE  |        IPV4         | IPV6 |    TYPE    | SNAPSHOTS |
+--------+---------+---------------------+------+------------+-----------+
| first  | RUNNING | 10.70.45.163 (eth0) |      | PERSISTENT | 0         |
+--------+---------+---------------------+------+------------+-----------+
| second | STOPPED |                     |      | PERSISTENT | 0         |
+--------+---------+---------------------+------+------------+-----------+
root at kemi-desktop:/home/kemi/git# 
root at kemi-desktop:/home/kemi/git# lxc exec first -- bash
root at first:~# 
root at first:~# ps -ef|grep udev
root        61     1  0 Nov01 ?        00:00:00 /lib/systemd/systemd-udevd
root      2252  2241  0 05:07 ?        00:00:00 grep --color=auto udev
root at first:~# 

Seems udevd (I used ubuntu 18.04 image) is running in lxc container.
Correct me if I misunderstood something, thx.

> 
> The second one occurs when an app in container begins to run, it will read
>> /sys/devices/system/cpu/online file to get avilable cpu number before
>> creating
>> threads accordingly. Then. the problem is,  sysfs now is shared with host,
>> it will get the CPU number equals to host thread number even if the cpu
>> number
>> of container is limited.
>>
>>
> If it simply reads the file, you could simply mount a text file on it.
> Similar to what lxcfs does, but simpler.
> 

Good suggestion. We are considering this workaround.
But it may not be a common solution, because on one knows which file in /sys
will be used by app in userspace.

> 
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
> 


More information about the lxc-users mailing list