Skip to content

Commit f145cd4

Browse files
lirui34dbkinder
authored andcommitted
doc: Instruction of enabling ACRN-DM QoS.
Add instruction of enabling ACRN-DM QoS based on runC container. Tracked-On: #3131 Signed-off-by: ruix.li <ruix.li@intel.com>
1 parent fd9eb2a commit f145cd4

File tree

3 files changed

+119
-0
lines changed

3 files changed

+119
-0
lines changed

doc/tutorials/acrn-dm_QoS.rst

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
.. _acrn-dm_qos:
2+
3+
Enable QoS based on runC container
4+
##################################
5+
This document describes how ACRN supports Device-Model Quality of Service (QoS)
6+
based on using runC containers to control the SOS resources
7+
(CPU, Storage, Memory, Network) by modifying the runC configuration file.
8+
9+
What is QoS
10+
***********
11+
Traditionally, Quality of Service (QoS) is the description or measurement
12+
of the overall performance of a service, such as a `computer network
13+
<https://en.wikipedia.org/wiki/Computer_network>`_ or a `cloud computing
14+
<https://en.wikipedia.org/wiki/Cloud_computing>`_ service,
15+
particularly the performance is seen by the users on the network.
16+
17+
What is runC container
18+
**********************
19+
Containers are an abstraction at the application layer that packages code
20+
and dependencies together. Multiple containers can run on the same machine
21+
and share the OS kernel with other containers, each running as
22+
isolated processes in user space. `runC
23+
<https://github.com/opencontainers/runc>`_, a lightweight universal container runtime,
24+
is a command-line tool for spawning and running containers according
25+
to the `Open Container Initiative (OCI)
26+
<https://www.opencontainers.org/>`_ specification.
27+
28+
ACRN-DM QoS architecture
29+
************************
30+
In ACRN-DM QoS design, we run the ACRN-DM in a runC container environment.
31+
Every time we start a UOS, we first start a runC container and
32+
then launch the ACRN-DM within that container.
33+
The ACRN-DM QoS can manage these resources for Device-Model:
34+
35+
- CPU utilization
36+
- Memory amount/limitation
37+
- I/O bandwidth
38+
- Network throughput
39+
40+
.. figure:: images/acrn-dm_qos_architecture.png
41+
:align: center
42+
43+
ACRN-DM QoS architecture
44+
45+
ACRN-QoS CPU utilization example
46+
********************************
47+
In runC ``config.json`` we set the CPU resource as shown below for VM0 and VM1:
48+
49+
.. code-block:: none
50+
51+
"cpu": {
52+
"shares": 1024,
53+
"quota": 1000000,
54+
"period": 500000,
55+
"realtimeRuntime": 950000,
56+
"realtimePeriod": 1000000,
57+
"mems": "0-7"
58+
},
59+
60+
In this example the `cpu.shares
61+
<https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/resource_management_guide/sec-cpu>`_
62+
value is 1024, so the VM0 and VM1 device model
63+
CPU utilization is ``1024 / (1024 + 1024 + 1024) = 33%``, which means
64+
the maximal CPU resource for the VM0 or VM1 is 33% of the entire CPU resource.
65+
66+
.. figure:: images/cpu_utilization_image.png
67+
:align: center
68+
69+
CPU utilization image
70+
71+
How to use ACRN-DM QoS
72+
**********************
73+
#. Add these parameters to the ``runC.json`` file:
74+
75+
.. code-block:: none
76+
77+
# vim /usr/share/acrn/samples/nuc/runC.json
78+
79+
.. code-block:: none
80+
81+
"linux": {
82+
"resources": {
83+
"memory": {
84+
"limit": 536870912,
85+
"reservation": 536870912,
86+
"swap": 536870912,
87+
"kernel": -1,
88+
"kernelTCP": -1,
89+
"swappiness": 0,
90+
"disableOOMKiller": false
91+
},
92+
"cpu": {
93+
"shares": 1024,
94+
"quota": 1000000,
95+
"period": 500000,
96+
"mems": "0-7"
97+
},
98+
"devices": [
99+
{
100+
"allow": true,
101+
"access": "rwm"
102+
}
103+
]
104+
},
105+
106+
.. note:: For configuration details, refer to the `Open Containers configuration documentation
107+
<https://github.com/opencontainers/runtime-spec/blob/master/config.md>`_.
108+
109+
#. Add the UOS by ``acrnctl add`` command:
110+
111+
.. code-block:: none
112+
113+
# acrnctl add launch_uos.sh -C
114+
115+
#. Start the UOS by ``acrnd``
116+
117+
.. code-block:: none
118+
119+
# acrnd -t
106 KB
Loading
73.7 KB
Loading

0 commit comments

Comments
 (0)