Alpha 1.9.0 - resource limit not working

Hi,

I’ve installed alpha version with cool features but I cannot achieve resource limit to work.

OS is Ubuntu 24.04, I’ve created package like:

When I make requests with Apache benchmark tool load goes up.

What’s wrong?

Thanks

Anyone? :slight_smile:

I was able to reproduce your problem on 1.9.0~alpha. I’ve set up an user with CPU limits:
grafik

The first test was to run just a while loop on all CPUs with the following command:

for i in 1 2 3 4; do while : ; do : ; done & done

The CPU load increased to 100% on each CPU:
grafik

Then I’ve checked the CPU usage when getting a wordpress page regularly from another system:

Hello
Can you share how you conducted your test? Please include all the commands you ran, as I don’t have much time to review the Apache Benchmark tools and documentation

@ronald and @damirl: Could you please perform the test again and share the results? Make sure to SSH directly into the user account you are testing, instead of switching users using su. Let us know the outcome. Thanks!

This bug has already been published [Bug] Climits only active for login not for PHP FPM user · Issue #4659 · hestiacp/hestiacp · GitHub

@jekasumy if I understood you have run a load test outside the user account ? Right

I ran it under an account. It’s more of a question of fpm limitation
The problem is known.

It currently only works when a user logins via ssh… as the user not as root or via php-fpm / apache2 / whatever

I’e tried it using a SSH test user with 10% CPU limit. Everything works fine:


grafik

Hello,
I need some testers to test this solution:

If everything works fine, I will submit a pull request. The best way to test it is through load testing.

Hello.
I created process-slice-manager.service and process-slice-manager.sh, made the script executable. I activated and launched the service, process-slice-manager.pid appeared. log file was not created automatically and even when creating it manually, no entries were added to it. I looked at the CPU usage on real sites with Woocommerce (the package was configured to limit 10%) – unfortunately, the restrictions did not work.

If the log file is not created that means the service is not running, check the status of service, if you don’t see any entries in: tail -f /var/log/process-monitor.log , the service is not running, the install must be as root user

Of course, running as root

process-slice-manager.service - Process Slice Manager Service
     Loaded: loaded (/etc/systemd/system/process-slice-manager.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-12-15 21:06:04 EET; 5min ago
   Main PID: 3610279 (process-slice-m)
      Tasks: 2 (limit: 19148)
     Memory: 1.5M (peak: 5.0M)
        CPU: 2min 1.412s
     CGroup: /system.slice/process-slice-manager.service
             ├─3610279 /bin/bash /usr/local/bin/process-slice-manager.sh start
             └─3697084 sleep 2

but there are errors

/usr/local/bin/process-slice-manager.sh: line 143: /sys/fs/cgroup/cpu/wordpress-wc/tasks: Permission denied
/usr/local/bin/process-slice-manager.sh: line 146: /sys/fs/cgroup/memory/wordpress-wc/tasks: Permission denied

You have an error in the instructions on the github about the log file.
should not be

tail -f /var/log/process-monitor.log

should be

tail -f /var/log/process-slice-manager.log

Ok I updated the doc, the error you get means you are running the script as not root, check the user of
/usr/local/bin/process-slice-manager.sh and try to run this directly in your server:
echo 116 > /sys/fs/cgroup/cpu/wordpress-wc/tasks


root@dash:~# ls -na /sys/fs/cgroup/cpu/wordpress-wc/
total 0
drwxr-xr-x 2 0 0 0 Dec 15 21:47 .
drwxr-xr-x 8 0 0 0 Dec 15 20:26 ..
-r--r--r-- 1 0 0 0 Dec 15 21:36 cgroup.controllers
-r--r--r-- 1 0 0 0 Dec 15 21:36 cgroup.events
-rw-r--r-- 1 0 0 0 Dec 15 21:36 cgroup.freeze
--w------- 1 0 0 0 Dec 15 21:36 cgroup.kill
-rw-r--r-- 1 0 0 0 Dec 15 21:36 cgroup.max.depth
-rw-r--r-- 1 0 0 0 Dec 15 21:36 cgroup.max.descendants
-rw-r--r-- 1 0 0 0 Dec 15 21:36 cgroup.pressure
-rw-r--r-- 1 0 0 0 Dec 15 21:45 cgroup.procs
-r--r--r-- 1 0 0 0 Dec 15 21:36 cgroup.stat
-rw-r--r-- 1 0 0 0 Dec 15 21:36 cgroup.subtree_control
-rw-r--r-- 1 0 0 0 Dec 15 21:36 cgroup.threads
-rw-r--r-- 1 0 0 0 Dec 15 21:36 cgroup.type
-rw-r--r-- 1 0 0 0 Dec 15 21:36 cpu.pressure
-r--r--r-- 1 0 0 0 Dec 15 21:36 cpu.stat
-r--r--r-- 1 0 0 0 Dec 15 21:36 cpu.stat.local
-rw-r--r-- 1 0 0 0 Dec 15 21:36 io.pressure
-rw-r--r-- 1 0 0 0 Dec 15 21:36 memory.pressure

ok i have updated the script: process-slice-manager.sh , wich distribution do you have ? can you update ths .sh script and :

sudo systemctl daemon-reload
sudo systemctl restart process-slice-manager.service

The issue is you don’t have the cgroup task

Hi. Ubuntu 24.04.

Updated and restarted service.
Errors:

/usr/local/bin/process-slice-manager.sh: line 78: /sys/fs/cgroup/cpu/wordpress/cpu.cfs_period_us: Permission denied
/usr/local/bin/process-slice-manager.sh: line 79: /sys/fs/cgroup/cpu/wordpress/cpu.cfs_quota_us: Permission denied
/usr/local/bin/process-slice-manager.sh: line 94: /sys/fs/cgroup/memory/wordpress/memory.limit_in_bytes: Permission denied
/usr/local/bin/process-slice-manager.sh: line 107: /sys/fs/cgroup/memory/wordpress/memory.memsw.limit_in_bytes: Permission denied

I see that no such files exist that are accessed by the script.
What we have:

root@dash:~# ls -na /sys/fs/cgroup/memory/wordpress/
total 0
drwxr-xr-x 2 0 0 0 Dec 16 12:07 .
drwxr-xr-x 8 0 0 0 Dec 15 20:26 ..
-r--r--r-- 1 0 0 0 Dec 16 12:07 cgroup.controllers
-r--r--r-- 1 0 0 0 Dec 16 12:07 cgroup.events
-rw-r--r-- 1 0 0 0 Dec 16 12:07 cgroup.freeze
--w------- 1 0 0 0 Dec 16 12:07 cgroup.kill
-rw-r--r-- 1 0 0 0 Dec 16 12:07 cgroup.max.depth
-rw-r--r-- 1 0 0 0 Dec 16 12:07 cgroup.max.descendants
-rw-r--r-- 1 0 0 0 Dec 16 12:07 cgroup.pressure
-rw-r--r-- 1 0 0 0 Dec 16 12:07 cgroup.procs
-r--r--r-- 1 0 0 0 Dec 16 12:07 cgroup.stat
-rw-r--r-- 1 0 0 0 Dec 16 12:07 cgroup.subtree_control
-rw-r--r-- 1 0 0 0 Dec 16 12:07 cgroup.threads
-rw-r--r-- 1 0 0 0 Dec 16 12:07 cgroup.type
-rw-r--r-- 1 0 0 0 Dec 16 12:07 cpu.pressure
-r--r--r-- 1 0 0 0 Dec 16 12:07 cpu.stat
-r--r--r-- 1 0 0 0 Dec 16 12:07 cpu.stat.local
-rw-r--r-- 1 0 0 0 Dec 16 12:07 io.pressure
-rw-r--r-- 1 0 0 0 Dec 16 12:07 memory.pressure
root@dash:~# ls -na /sys/fs/cgroup/cpu/wordpress/   
total 0
drwxr-xr-x 2 0 0 0 Dec 16 12:10 .
drwxr-xr-x 8 0 0 0 Dec 15 21:47 ..
-r--r--r-- 1 0 0 0 Dec 16 12:10 cgroup.controllers
-r--r--r-- 1 0 0 0 Dec 16 12:10 cgroup.events
-rw-r--r-- 1 0 0 0 Dec 16 12:10 cgroup.freeze
--w------- 1 0 0 0 Dec 16 12:10 cgroup.kill
-rw-r--r-- 1 0 0 0 Dec 16 12:10 cgroup.max.depth
-rw-r--r-- 1 0 0 0 Dec 16 12:10 cgroup.max.descendants
-rw-r--r-- 1 0 0 0 Dec 16 12:10 cgroup.pressure
-rw-r--r-- 1 0 0 0 Dec 16 12:09 cgroup.procs
-r--r--r-- 1 0 0 0 Dec 16 12:10 cgroup.stat
-rw-r--r-- 1 0 0 0 Dec 16 12:10 cgroup.subtree_control
-rw-r--r-- 1 0 0 0 Dec 16 12:10 cgroup.threads
-rw-r--r-- 1 0 0 0 Dec 16 12:10 cgroup.type
-rw-r--r-- 1 0 0 0 Dec 16 12:10 cpu.pressure
-r--r--r-- 1 0 0 0 Dec 16 12:10 cpu.stat
-r--r--r-- 1 0 0 0 Dec 16 12:10 cpu.stat.local
-rw-r--r-- 1 0 0 0 Dec 16 12:10 io.pressure
-rw-r--r-- 1 0 0 0 Dec 16 12:10 memory.pressure

You are in cgroup2, can you list me the content of this commande:

mount | grep cgroup