So this is my first time posting on Ubuntu forums, so please excuse me if this question is repetitive, or just plain stupid.
A bit of background: I am a 14yr old developer, who has an ubuntu 20.04 server. I started a small hosting service and we racked up quite a bit of clients. Now, we have a pricing model, like certian users can only get 1vCPU and 4GB Ram, while other users can have 6vCPUs and 20GB Ram For $80 Per 6 Months.
My Problem: I cannot limit how many vCPUs and RAM a user can get. I tried programs like cgroups, but when I checked how much ram a user had by free -m, the server returned to me 24GB (How Much Memory On The VM).
My Question: Is there a proper way to limit a specific user's RAM and vCPU usage? Preferably, if you could give me a guide that would be perfect! Thanks in advance for any help you can offer!
Making Some Progress: With cgroup, I can limit a specific user's CPU usage (/sys/fs/cgroup/user.slice/user-USERID.slice). In here, I can edit the cpu.cfs_quota_us, but this only limits CPU Percentage. Also a weird thing for me, when I do cat cpu.cfs_quota_us I get 200000? Isnt that 200%? I thought the default value for max was 101000? Still my main question is, how can I limit each user's core count, and memory?
More Progress: according to redhatguideforcgroup instead of using the cpu directory, the cpuset directory manages Multicore which is what I think I need.
Now IK I am getting close. While in the /sys/fs/cgroup/cpuset DIR I can run cat cpuset.cpus and that returns to me 0-5 (which is all the 6 cores I have present on my VM). Now if someone who knows basic cgroups (v2) can help me out to how I can set that to a specific user, I would appreciate that. this helped me