What is Cloud Linux?
Cloudlinux is a linux distribution which helps to implement user isolations and provide separate resources for users; so that resource usage problem on one account does not affect others. This feature helps to control the shared hosting accounts and increase the server stability and security. So let’s get discuss on Understanding LVE usage and OOM killer in Cloud Linux on Plesk
This blog is to provide a basic concept of Cloudlinux functionalities in a Shared Plesk server, focusing on OutOfMemory (OOM).
Convert a plesk-based server from CentOS to CloudLinux OS
Cloudlinux is very easy to install. You should purchase an IP based license from cloudlinux. Login to server as root and execute the below script to convert a plesk centos 6 server to CloudLinux.
$ wget https://repo.cloudlinux.com/cloudlinux/sources/cln/cldeploy $ sh cldeploy -k # if you have activation key or $ sh cldeploy -i # if you have IP based license $ reboot
Once the installation is completed, the server will be rebooted.After server reboot, login to server and enter the command “uname -a”, to ensure the kernel change. Cloudlinux kernel contains the name lve. The LVE manager plugin will be automatically installed in plesk during the conversion process. It can be seen under the left menu.
Plesk LVE Manager
Plesk LVE manager is for setting limits and monitoring current usage of different users. To open LVE manager in plesk, Login to plesk and you can see the LVE manager option in the left panel as mentioned above.
There you can see different option such as:
- Current usage
Let’s take a close look on each options.
This tab is for monitoring the live usage. Here, we can monitor speed, memory, IO, IOPS, Process and Entry process. The resource usage of all users in the server will be listed here.
In this tab, all the users in the system is listed and their limits can be modified accordingly.
To set modify limits for a particular user, Click on the pencil icon and set the limit as per the requirements.
Click on save to apply the changes.
This option is to check the resource usage statistics. The statistics can be filtered by different options such as result in last 10 minutes, filter by average speed, LVE’s approaching limit etc.
This tab is for setting email notifications for limit faults for users and resellers.
Packages is used for setting limits to users. Every users will be a part of a particular packages.
From this tab, all the existing packages can be viewed and their limits can be modified accordingly. To create a package in plesk, create a service plan first, Then, that service plan will automatically be listed in the packages.
To create a service plan, Login to plesk and click on the service plan option from the left panel and click on add a plan.
Then provide a name and fill all the hosting values and permissions accordingly and save.
After that go to LVE manager, and click on packages tab. You will see the newly created service plan in the list of packages. Then edit the package by clicking on the pencil icon and you will be able enter the cloudlinux parameters values there. The following values can be entered.
- Virtual memory (VMEM) (can be set as unlimited by setting 0);
- Physical memory (PMEM) (can be set as unlimited by setting 0);
- Concurrent connections (EP);
- Number of processes (NPROC) (can be set as unlimited by setting 0);
- IOPS limits;
- I/O limits (IO) (can be set as unlimited by setting 0);
Commonly used Cloudlinux commands for quick reference
Command line tools
/usr/sbin/lveinfo utility to display historical information about LVE usage; /usr/sbin/lvechart creates a chart representing LVE usage for user; /usr/sbin/dbgovchart creates a chart representing MySQL usage for user; /usr/sbin/lve-read-snapshot displays information from system state (snapshots) for user; /usr/sbin/lve-create-db creates/recreates database for lve-stats; /usr/sbin/cloudlinux-top utility provides information about current MySQL and LVE usage of a running system in JSON format. /usr/sbin/cloudlinux-statistics utility provides historical information about resource usage.
OOM Killer in Cloudlinux
OOM Killer (out of memory killer) is a process in linux kernel that works when the system is out of memory, sometimes the requested memory may not be available in the physical memory due to over usage of memory by different process. At this situation, OOM killer is invoked by linux kernel and it reviews all the running process and kill some of the process to free up the memory.
In Cloudlinux, when a certain lve crosses its memory limit, The particular process inside the lve are killed by OOM killer and is logged in the location : /var/log/messages.
You can grep the log file for checking the OOM killer process details.
grep “oom-killer” /var/log/messages
Then the corresponding logs will be displayed.
Sep 10 22:02:26 leo kernel: [3526053.499503] 843640 (php-cgi) invoked oom-killer in ub 10494 generation 161 gfp 0x200d2 Sep 10 22:02:26 leo kernel: [3526053.771055] oom-killer in ub 10494 generation 161 ends: task died Sep 11 01:41:18 leo kernel: [3539185.664670] 940239 (php-cgi) invoked oom-killer in ub 10494 generation 162 gfp 0x200d2 Sep 11 01:41:18 leo kernel: [3539185.935638] oom-killer in ub 10494 generation 162 ends: task died Sep 11 05:11:02 leo kernel: [3551769.355279] 1035203 (php-cgi) invoked oom-killer in ub 10494 generation 163 gfp 0x200d2 Sep 11 05:11:02 leo kernel: [3551769.837642] oom-killer in ub 10494 generation 163 ends: task died Sep 11 05:11:56 leo kernel: [3551823.491910] 1034978 (php-cgi) invoked oom-killer in ub 10494 generation 164 gfp 0x200d2 Sep 11 05:11:56 leo kernel: [3551823.749497] oom-killer in ub 10494 generation 164 ends: task died
From the above logs, LVE ID of user can be used to check his usage. Copy the LVE ID(10494) and go to user’s tab in LVE manager and search for the corresponding ID. Then the particular user will be listed there and his usage can be tracked by clicking on the history button at the end.
If your application/website is acting strange like dropping connections or see messages like resource usage exceeded, it is likely a possibility that OOM killer is working in the background.
Are you lacking with basic concept of Cloudlinux functionalities?
We have an expert team to guide you
Thanks for dropping by. Ready for the next blog?