| ---------------------------------------- | |
| limited resources | |
| March 30th, 2021 | |
| ---------------------------------------- | |
| Tonight I set up resource limits on cosmic. Specifically I set up | |
| CPU and Memory limits for users. I don't get a lot of bad eggs | |
| amongst the voyagers, but it's easy to take a bigger slice of the | |
| pie than you intend on a tiny tilde. Someone had a newsreader | |
| running tonight that was accidentally using the entire 1024MB | |
| I have to offer. | |
| I wasn't sure how to set this up, so I did a little research and | |
| for once systemd came to the rescue. Here's what I did: | |
| ---- | |
| mkdir -p /etc/systemd/system/user-.slice.d | |
| cat > /etc/systemd/system/user-.slice.d/50-memory.conf << EOF | |
| [Slice] | |
| MemoryMax=80M | |
| CPUQuota=8% | |
| EOF | |
| sudo vim /etc/systemd/system.conf | |
| # uncomment and set the following values in that file: | |
| DefaultCPUAccounting=yes | |
| DefaultMemoryAccounting=yes | |
| systemctl daemon-reload | |
| ---- | |
| And that's it! I may tweak those quota values over time to make | |
| sure the system stays healthy but people can still use it. So far | |
| so good. |