Restricting System Service Resources
You can restrict resources related to MEF Edge processes by configuring Linux system services based on service requirements. If you do not set the resource limits, there is no resource limit by default. You can restrict the CPU and memory usage to ensure that services do not exceed the threshold continuously.
Service Name |
File Path |
|---|---|
edgecore |
/usr/lib/systemd/system/edgecore.service |
device-plugin |
/usr/lib/systemd/system/device-plugin.service |
mef-edge-main |
/usr/lib/systemd/system/mef-edge-main.service |
mef-edge-om |
/usr/lib/systemd/system/mef-edge-om.service |
- Log in to the device environment as the root user.
- Modify the service file and run :wq to exit. Take the EdgeCore service as an example:
vi /usr/lib/systemd/system/edgecore.service
Add or modify CPUQuota and MemoryMax in the [Service] field.
Table 2 Configuration Item
Description
CPUQuota
Sets the CPU time limit for the processes of this unit. The value must be a percentage ending with %, indicating the maximum percentage of the total time that the unit can use a single CPU.
MemoryMax
Rigidly sets the maximum memory that can be used by processes in this unit. The value can be an absolute size in bytes (K, M, G, or T suffix based on 1024), a relative size in percentage (relative to the total physical memory of the system), or the special value infinity, indicating that there is no limitation.
The following is an example of the modified service file:
[Service] UMask=0027 User=MEFEdge ... CPUQuota=15% MemoryMax=50M
- Run the following command to update the service file configuration:
systemctl daemon-reload