3 – View Website/User Resource Usage
Before reading this document you must read:
Once limits are applied, resource usage monitoring becomes important. You can view resource usage for any website at https://IP Of Your Server:8090/container/example.com
.
We will put stress on CPU, Memory and see how limits behave during the stress.
Testing CPU Performance
Run ls -la /home and find user of your website. Read the website limits document and grant 10% CPU usage to the website.
Now add your website user to the wheel group (usermod -aG wheel user) so it can run commands via sudo. (Don’t do this on a production node)
Install a stress testing tool
yum install stress -y
And then run this command to generate high CPU Load
sudo -u <website user> stress -c 3 -i 1 -m 1 --vm-bytes 128M -t 20s
Replace website user in the above command. Now before the limits are applied, your CPU usage should look something like this during the stress period.
As you can see currently limits are not applied, so the website user was able to use 100% of CPU. We will now enforce 10% of CPU usage and see the output.
Testing Memory Allocation
First run the command below without any limits being applied.
sudo -u <website user> stress -c 2 -i 1 -m 1 --vm-bytes 128M -t 20s
Output should be something like
Now apply 30MB of ram limit and run the same command:
Before limits are applied average memory usage was 110MB for the same command, after limits it could not exceed 30MB limit that we’ve applied.