Thanks for your reply, Its for production, I only have this app running on this server, I am currently setting monit to restart phoenix when beam CPU exceeds %90, but I need to know the reason behind this…
I think that the problem there may be that output is growing. Does memory usage grows as well? If so then maybe you should look for other runner than System.cmd/3 for better support for stuff like streaming command output.
I’m not familiar with cpulimit with systemd but I assume it uses cgroups and cpu quotas?
If so you’ll want to follow the same instructions for use with docker to disable the schedulers busy wait +sbwt none and to set the number of schedulers to a lower number depending on what you are limiting the cpu to. Before OTP-23 if you set a cpu limit the VM still booted 1 scheduler for every physical cpu on the system and not based on the cgroup configuration. So if you are limiting the cpus to 1 then you should add +S 1 to the vm.args. I’ve written about both of these in more depth here https://adoptingerlang.org/docs/production/kubernetes/#container-resources
This might not be the full issue you are having but it will at least get rid of any noise and allow you to investigate what your app is using CPU for, instead of VM overhead.