Тёмный

How to limit CPU usage on Ubuntu with Systemd cgroups - part I 

Nevyan Neykov
Подписаться 2,3 тыс.
Просмотров 11 тыс.
50% 1

Опубликовано:

 

26 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 29   
@NevyanNeykov
@NevyanNeykov 3 года назад
Don't forget to subscribe for new content: ru-vid.com
@mf-11111
@mf-11111 2 года назад
Hello from Argentina! I am so thankful for your explain in the video, because: I use Arch Linux on my laptop for my studies as software developer, and it was very useful to evade that my machine freeze and I can't use it, unless press reboot button (that's the only option).
@NevyanNeykov
@NevyanNeykov 2 года назад
Great to hear!
@MikkoRantalainen
@MikkoRantalainen 3 года назад
2:19 We can easily obtain our user id from /etc/passwd :D How about running "id -u" instead?
@NevyanNeykov
@NevyanNeykov 3 года назад
great tip :)
@AmrithaAnantha
@AmrithaAnantha Год назад
@nevyan Thanks for the video. I have a requirement to limit CPU and memory usage of a particular process using systemd and cgroup. Is there a separate video on this ? This limitation should apply to all users. Or is there a way to add my process name or id using the method shown in this video ?
@NevyanNeykov
@NevyanNeykov Год назад
Nice task I would also like to update the videos some day, as such cases need experimentation.
@kamalraj2213
@kamalraj2213 2 года назад
I have a question. I am having aks cluster. So how i can actually check whether cgroup has been there and how to check if there is limit and request for pod has been there in cgroup. Can someone help plz
@NevyanNeykov
@NevyanNeykov 2 года назад
if you are using Kubernetes you can check with: kubectl describe pod Name_of_pod for podman: sudo podman stats --no-stream Name_of_pod
@bigmike5678
@bigmike5678 4 года назад
Very nice. Helped me for sure.
@NevyanNeykov
@NevyanNeykov 4 года назад
Glad it helped!
@anupganvir4492
@anupganvir4492 Год назад
I changed CPUQuota=50% and my system became very slow now. Please advise how to revert these changes.
@NevyanNeykov
@NevyanNeykov Год назад
try to set them to -1 or 0.
@_VISION.
@_VISION. 2 года назад
What if you don't have a login user at the moment? I'm trying to do this in live boot mode before I download Linux again
@NevyanNeykov
@NevyanNeykov 2 года назад
hi, probably you can use system.slice.
@--_-_-_-_-_-_-_-_
@--_-_-_-_-_-_-_-_ 2 года назад
I can't find user.slice I have ubuntu 16.4
@NevyanNeykov
@NevyanNeykov 2 года назад
Please use more recent version of Ubuntu, probably the feature is not implemented in the cgroups.
@hannaescalante4421
@hannaescalante4421 3 года назад
Hello. How do you limit memory usage for mongodb using cgroups?
@NevyanNeykov
@NevyanNeykov 2 года назад
probably the same way as any other application ?
@MikkoRantalainen
@MikkoRantalainen 3 года назад
Do you know how to *easily* configure systemd to put all Google Chrome processes in a single memory cgroup and limit the max memory usage to 50% of the system RAM on Ubuntu? It used to be easy with cgmanager but that can no longer be used with systemd because systemd wants to control everything.
@NevyanNeykov
@NevyanNeykov 3 года назад
perhaps those ones could be of help: unix.stackexchange.com/questions/451577/limit-memory-for-browser-on-fedora unix.stackexchange.com/questions/659744/why-cant-cpulimit-limit-chromium-browser
@MikkoRantalainen
@MikkoRantalainen 3 года назад
@@NevyanNeykov Other than the example with `systemd-run` require using cgmanager which is no longer supported with recent systemd versions. And the `systemd-run` only works if that's the only way you actually launch that process.
@NevyanNeykov
@NevyanNeykov 3 года назад
Another possibility is to wrap the chromium process into a service where to use: MemoryMax to set the memory limit. On boot SystemD will auto start the service and apply the set limits to each new chromium instance.
@MikkoRantalainen
@MikkoRantalainen 3 года назад
@@NevyanNeykov How would you do that? Chromium requires a separate X display connection for each logged in user. With cgmanager it was simple to create one memory cgroup for Chrome/Chromium but with systemd there doesn't seem to be any simple way to do that.
@NevyanNeykov
@NevyanNeykov 3 года назад
here is for firefox I guess: serverfault.com/questions/1058897/applying-systemd-control-group-resource-limits-automatically-to-specific-user-ap
@Dan-hh7ve
@Dan-hh7ve 4 года назад
thanks for sharing Nevyan, what about settings for ex. CPUQuota for 1000 user permanently ? so it keeps this limit after reboot
@NevyanNeykov
@NevyanNeykov 4 года назад
From my case it was keeping the settings set, on one system I even had to reset them by setting them to -1. Depends on the systemd version I guess, otherwise you set them before provisioning the machine. From the docs: systemctl set-property - the adjustments will be made permanent unless --runtime option is passed.
@bigmike5678
@bigmike5678 4 года назад
@@NevyanNeykov I believe the settings are permanent unless you use the --runtime option from set-property
@NevyanNeykov
@NevyanNeykov 4 года назад
@@bigmike5678 exactly.
Далее
How Docker Works - Intro to Namespaces
12:56
Просмотров 168 тыс.
TEAM SPIRIT: НОВЫЙ СОСТАВ. SEASON 24-25
01:31
How to understand the linux control groups cgroups
20:34
Fedora vs Debian and Arch Linux
17:32
Просмотров 519 тыс.
cgroups || control groups?
6:14
Просмотров 8 тыс.
Richard Stallman Talks About Ubuntu
6:10
Просмотров 1,4 млн
Why so many distros? The Weird History of Linux
8:23
How Does Linux Boot Process Work?
4:44
Просмотров 641 тыс.