25.4. 명령줄에서 메모리 리소스 제어 설정 구성
명령줄 인터페이스에서 명령을 실행하는 것은 프로세스 그룹의 하드웨어 리소스에 대한 제한을 설정, 우선 순위 또는 제어하는 방법 중 하나입니다.
프로세스
서비스의 메모리 사용량을 제한하려면 다음을 실행합니다.
# systemctl set-property example.service MemoryMax=1500K
이 명령은
example.service
서비스가 속한 제어 그룹에서 실행되는 프로세스에 ScanSettingKB의 메모리 제한을 즉시 할당합니다.MemoryMax
매개변수는/etc/systemd/system.control/example.service.d/50-MemoryMax.conf
파일에 정의되어 있으며/sys/fs/cgroup/memory/system.slice/example.service/memory.limit_in_bytes
파일에 정의됩니다.선택적으로 서비스의 메모리 사용량을 일시적으로 제한하려면 다음을 실행합니다.
# systemctl set-property --runtime example.service MemoryMax=1500K
이 명령은
example.service
서비스에 메모리 제한을 즉시 할당합니다.MemoryMax
매개변수는/run/systemd/system.control/example.service.d/50-MemoryMax.conf
파일에서 다음 재부팅될 때까지 정의됩니다. 재부팅하면 전체/run/systemd/system.control/
디렉터리 및MemoryMax
가 제거됩니다.
50-MemoryMax.conf
파일은 메모리 제한을 4096바이트의 배수( AMD64 및 Intel 64에 고유한 커널 페이지 크기)로 저장합니다. 실제 바이트 수는 CPU 아키텍처에 따라 다릅니다.
추가 리소스
-
systemd.resource-control(5)
및cgroups(7)
매뉴얼 페이지 - 제어 그룹에서 systemd의 역할