High load in lack of ram

I have a container that is ram hungry.
If ram usage go higher than memory limit, cpu load goes up and if increase memory limit load comes low.
How can i restrict load from going up in this situation?

You can’t restrict the load as on Linux load average refers to the number of processes that are waiting to be scheduled. You can totally have a system with a load of 1000 that doesn’t actually have any CPU usage and is perfectly reactive.

In your case, the load is likely increasing because more processes in that container find themselves stuck waiting for memory or other I/O operations to be possible. This won’t make your system any slower but it will increase the load average since more processes are now waiting.

1 Like

Can i restrict the number of processes that a container can run?

Yes, the pids cgroup lets you do that. In LXD, that’d be limits.processes, for plain liblxc, that’d be lxc.cgroup.pids.max