Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
litespeed_wiki:cloudlinux:lsphp_criu_enable [2018/05/11 12:14] Eric Leu [How to Verify] |
litespeed_wiki:cloudlinux:lsphp_criu_enable [2018/07/20 01:33] qtwrk [Requirements] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== How to enable CRIU ====== | + | ====== How to Enable LSPHP CRIU on CloudLinux ====== |
- | ===== Summary ===== | + | Checkpoint/Restore In Userspace, or CRIU, is an open source project which dumps all of the information of a running process to disk and restores it at the point of the dump. The LiteSpeed Enterprise Edition Web Server now supports CRIU both natively, and for the CloudLinux/Apache-specific implementation of the PHP processor. This will improve the performance of LiteSpeed for transactions which are commonly used, and reduce the memory overhead on the server. |
- | Checkpoint/Restore In Userspace, or CRIU, is an open source project which dumps all of the information of a running process to disk and restores it at the point of the dump. The Litespeed Enterprise Edition Web Server now supports CRIU both natively, and for the CloudLinux/Apache specific implementation for the PHP processor. This will improve the performance of Litespeed for transactions which are commonly used and reduce the memory overhead on the server. | + | ===== Requirements ===== |
- | ===== Must ===== | ||
- | |||
- | - Running as the root user to use CRIU Litespeed or Apache. The CRIU facility requires Litespeed run as the root user to perform the snapshot and recovery. Running as a non-root user automatically disables CRIU. | ||
- CloudLinux System | - CloudLinux System | ||
+ | - LiteSpeed Web Server 5.3 or above. | ||
+ | - LiteSpeed must be running as the root user to use CRIU LiteSpeed or Apache. Root is required in order to perform the snapshot and recovery. Running as a non-root user automatically disables CRIU. | ||
===== Installation ===== | ===== Installation ===== | ||
- | ==== 1. CRIU enabled from System ==== | + | |
- | Login your Linux system. Check CRIU service is running or not. \\ | + | ==== 1. Verify CRIU is enabled on your system ==== |
- | If not, enable by following method \\ | + | Log into your Linux system. Check CRIU whether the service is running or not. \\ |
+ | If not, enable by following method: | ||
<code> | <code> | ||
systemctl enable criu | systemctl enable criu | ||
Line 19: | Line 19: | ||
systemctl status criu | systemctl status criu | ||
</code> | </code> | ||
- | Output **''Active: active (running)''** | + | Output should be ''Active: active (running)''. |
- | ====2. CRIU parameter check==== | + | ====2. Check CRIU parameters==== |
- | Generally PHP should be compiled with criu already. \\ | + | Generally PHP should be compiled with CRIU already. \\ |
- | Through ''phpinfo()'' to check LSPHP build with parameter: ''-DWITH_CRIU''. | + | Use ''phpinfo()'' with parameter ''-DWITH_CRIU'' to check the LSPHP build. |
If you want to manually compile, please download LSAPI from [[https://www.litespeedtech.com/open-source/litespeed-sapi/download | here ]] | If you want to manually compile, please download LSAPI from [[https://www.litespeedtech.com/open-source/litespeed-sapi/download | here ]] | ||
- | ====3. php env config==== | + | ====3. Configure the PHP environment==== |
- | Add following necessary parameter to the PHPx.x External App -> Environment \\ | + | Add the following necessary parameter to the PHPx.x **External App > Environment** \\ |
<code> | <code> | ||
LSAPI_CRIU=1 | LSAPI_CRIU=1 | ||
Line 35: | Line 35: | ||
{{:litespeed_wiki:cloudlinux:criu-2.png?|}} | {{:litespeed_wiki:cloudlinux:criu-2.png?|}} | ||
- | ====Important Syntax==== | + | ===Important Syntax=== |
^Variable^Values^Default^Description^ | ^Variable^Values^Default^Description^ | ||
|LSAPI_CRIU|1/On/Off|Off|If set to On, CRIU will be performed. 1=On| | |LSAPI_CRIU|1/On/Off|Off|If set to On, CRIU will be performed. 1=On| | ||
Line 43: | Line 43: | ||
===== How to Verify ===== | ===== How to Verify ===== | ||
- | **Step 1** \\ | + | ====Step 1==== |
- | - Prepare any php site, e.g. WordPress | + | - Prepare any PHP site, e.g. WordPress |
- | + | ====Step 2==== | |
- | **Step 2** \\ | + | |
- Generate the dump by hitting the WordPress site | - Generate the dump by hitting the WordPress site | ||
- Hit more than INITIAL_START number, e.g. 20 times | - Hit more than INITIAL_START number, e.g. 20 times | ||
- | - If image dump generated, you should see an image folder under ''/var/run/lsws/cl_criu/'' | + | - If an image dump is generated, you should see an image folder under ''/var/run/lsws/cl_criu/'' |
- | **Step 3** \\ | + | ====Step 3==== |
- | - Check PHP process number by \\ ''ps -ef | grep php'' \\ ''>>> user 868577 ... 10:54 0:00 lsphp'' | + | - Check the PHP process number by <code>ps -ef | grep php |
- | - Kill the lsphp process \\ ''kill -9 868577'' | + | >>> user 868577 ... 10:54 0:00 lsphpL</code> |
- | **Step 4** \\ | + | - Kill the lsphp process via <code>kill -9 868577</code> |
- | - To restore the PHP by refreshing the WordPress page to regenerate it | + | ====Step 4==== |
- | - Verify the process number is same as before \\ ''ps -ef | grep php'' \\ ''user 868577 ... 10:55 0:00 lsphp'' \\ Process is **back**!! | + | - Restore the PHP by refreshing the WordPress page to regenerate it |
- | - You can also check standard error log \\ ''LSCRIU: Successful CloudLinux dump of PID: 868577'' \\ ''LSCRIU: Successful CloudLinux restore of PID: 868577, parent: 1.'' | + | - Verify the process number is the same as before:<code>ps -ef | grep php |
+ | >>> user 868577 ... 10:55 0:00 lsphp</code>The process is **back**!! | ||
+ | - You can also check standard error log for something like <code>LSCRIU: Successful CloudLinux dump of PID: 868577 | ||
+ | LSCRIU: Successful CloudLinux restore of PID: 868577, parent: 1.</code> | ||
===== Logs ===== | ===== Logs ===== | ||
- | - **Error log** default locate at Apache standard error log | + | - **Error log** default located at Apache standard error log |
- | - **dump.log** is in the images directory | + | - ''dump.log'' is in the images directory |
- | - **restore.log** is in the images directory | + | - ''restore.log'' is in the images directory |
- | * restore.log will gets generated even though there is no dump, so it's expected to see some related fail logs | + | |
+ | **NOTE**: ''restore.log'' is generated even when there is no dump, so it's expected to see some related fail logs | ||