Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:cloudlinux:lsphp_criu_enable [2018/05/11 12:14]
Eric Leu [How to Verify]
litespeed_wiki:cloudlinux:lsphp_criu_enable [2019/10/15 18:41] (current)
Lisa Clarke [Enabling CRIU on CloudLinux + cPanel EA4 + LSWS]
Line 1: Line 1:
-====== ​How to enable ​CRIU ======+====== ​Enabling ​CRIU on CloudLinux + cPanel EA4 ======
  
-===== Summary =====+**IMPORTANT!! CRIU may cause stability issues! Enable CRIU AT YOUR OWN RISK!**
  
-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.+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 for the CloudLinux implementation ​of the PHP processor. ​
  
-===== Must =====+However, generally, we don't recommend you enable CRIU unless you have a special requirement for it. CRIU uses significant server resources and may generate unusual errors while providing no performance benefits. ​
  
-  - Running as the root user to use CRIU Litespeed or ApacheThe CRIU facility requires Litespeed run as the root user to perform the snapshot and recovery. Running as a non-root user automatically disables ​CRIU. +**We have received quite a few reports that potential bugs on the CRIU module may cause web server stability issuesPlease permanently disable ​CRIU, or enable ​CRIU AT YOUR OWN RISK** 
-  - CloudLinux System+ 
 +===== Requirements ===== 
 + 
 +  - CloudLinux System ​ 
 +  - ea-apache24-mod_lsapi 1.1 on cpanel EA4 (or mod_lsapi on cPanel EA3)  or above  
 +  - LiteSpeed Web Server 5.3 or above. 
 + 
  
 ===== Installation ===== ===== Installation =====
-==== 1. CRIU enabled ​from System ​==== + 
-Login your Linux system. Check CRIU service is running or not. \\ +==== Verify ​CRIU is enabled ​on your system ​==== 
-If not, enable by following method ​\\+ 
 +Criu is installed with dependency to ea-apache24-mod_lsapi for cpanel EA4( or mod_lsapi for cpanel EA3) 1.1 and above package.  
 + 
 +If you have not installed it, you should: 
 + 
 +<​code>​yum install liblsapi liblsapi-devel</​code>​ 
 + 
 +<​code>​ 
 +============================================================================================================================================================================= 
 + ​Package ​                               Arch                          Version ​                                       Repository ​                                        ​Size 
 +============================================================================================================================================================================= 
 +Installing: ​                                                                                                                                                               
 + ​liblsapi ​                              ​x86_64 ​                       1.1-28.el7.cloudlinux ​                         cloudlinux-x86_64-server-7 ​                       180 k 
 + ​liblsapi-devel ​                        ​x86_64 ​                       1.1-28.el7.cloudlinux ​                         cloudlinux-x86_64-server-7 ​                        37 k 
 +Installing for dependencies: ​                                                                                                                                              
 + ​crit-lve ​                              ​x86_64 ​                       3.7-3.el7 ​                                     cloudlinux-x86_64-server-7 ​                       9.6 k 
 + ​criu-lve ​                              ​x86_64 ​                       3.7-3.el7 ​                                     cloudlinux-x86_64-server-7 ​                       439 k 
 + ​criu-lve-devel ​                        ​x86_64 ​                       3.7-3.el7 ​                                     cloudlinux-x86_64-server-7 ​                        11 k 
 + ​libnet ​                                ​x86_64 ​                       1.1.6-7.el7 ​                                   cloudlinux-x86_64-server-7 ​                        58 k 
 + ​protobuf-c ​                            ​x86_64 ​                       1.0.2-3.el7 ​                                   cloudlinux-x86_64-server-7 ​                        27 k 
 + ​protobuf-python ​                       x86_64 ​                       2.5.0-8.el7 ​                                   cloudlinux-x86_64-server-7 ​                       129 k 
 + ​python-criu-lve ​                       x86_64 ​                       3.7-3.el7 ​                                     cloudlinux-x86_64-server-7 ​                       136 k 
 + ​python-ipaddr ​                         noarch ​                       2.1.11-1.el7 ​                                  ​cloudlinux-x86_64-server-7 ​                        34 k 
 +                                                                                                                                                                           
 +Transaction Summary 
 +============================================================================================================================================================================= 
 +Install ​ 2 Packages (+8 Dependent packages) 
 +</​code>​ 
 + 
 +<​code>​yum install ea-apache24-mod_lsapi</​code>​ 
 + 
 +Check CRIU whether the service is running or not. \\ 
 + 
 +  ps -ef | grep criu 
 +  root      967641 ​      ​1 ​ 0 19:24 ?        00:00:00 /​usr/​sbin/​criu service -v4 -o /​var/​log/​criu-service.log --address /​var/​run/​criu/​criu_service.socket 
 +  root      967680 ​ 965818 ​ 0 19:24 pts/1    00:00:00 grep --color=auto criu 
 + 
 +   
 + 
 +If not, enable by following method:
 <​code>​ <​code>​
-systemctl enable criu+systemctl enable criu 
 systemctl start criu systemctl start criu
 systemctl status criu systemctl status criu
 </​code>​ </​code>​
-Output **''​Active:​ active (running)''​** 
  
-====2. CRIU parameter check==== 
-Generally PHP should be compiled with criu already. ​  \\ 
-Through ''​phpinfo()''​ to check LSPHP build with parameter: ''​-DWITH_CRIU''​. 
  
-If you want to manually compile, please download LSAPI from [[https://www.litespeedtech.com/​open-source/​litespeed-sapi/​download | here ]]+Output should be ''​Activeactive (running)''​.
  
-====3php env config==== +  [root@globalsupport ~]# systemctl status criu 
-Add following necessary parameter to the PHPx.x External App -> Environment \\+  ● criu.service - Checkpoint Restore in Userspace daemon 
 +   ​Loaded:​ loaded (/​usr/​lib/​systemd/​system/​criu.service;​ disabled; vendor preset: disabled) 
 +   ​Active:​ active (running) since Mon 2018-08-20 19:24:25 UTC; 4min 23s ago 
 +  Process: 967640 ExecStartPre=/bin/mkdir -p /​var/​run/​criu (code=exited, status=0/​SUCCESS) 
 +  Main PID: 967641 (criu) 
 +   ​CGroup:​ /​system.slice/​criu.service 
 +           ​└─967641 /​usr/​sbin/​criu service -v4 -o /​var/​log/​criu-service.log --address /​var/​run/​criu/​criu_service.socket 
 + 
 +  Aug 20 19:24:25 globalsupport.litespeedtech.com systemd[1]: Starting Checkpoint Restore in Userspace daemon... 
 +  Aug 20 19:24:25 globalsupport.litespeedtech.com systemd[1]: Started Checkpoint Restore in Userspace daemon. 
 +  Aug 20 19:24:25 globalsupport.litespeedtech.com criu[967641]:​ Warn  (criu/​kerndat.c:​660):​ Can't load /​run/​criu.kdat 
 + 
 +====CRIU Master Switch on LSWS ==== 
 +CRIU is disabled by defaultTo enable it, you can go to LSWS Web Admin Console -> Server -> PHP -> PHP Global Configuration -> Enable CRIU( Again, we recommend you keep CRIU off unless you have some speical testing need only). 
 +{{:​litespeed_wiki:​cloudlinux:​lsws-master-criu-switch.png?​800|}} 
 + 
 +==== Check CRIU parameters==== 
 +In CloudLinux, LSPHP have been compiled with CRIU already. Please check [[https://​docs.cloudlinux.com/​index.html?​criu_support.html|here]] ​  \\ 
 +Use ''​phpinfo()''​ with parameter ''​-DWITH_CRIU''​ to check the LSPHP build. 
 + 
 + 
 + 
 +====Configure the PHP environment==== 
 +Add the following necessary parameter to the PHPx.x ​**External App > Environment** \\
 <​code>​ <​code>​
 LSAPI_CRIU=1 LSAPI_CRIU=1
Line 35: Line 99:
 {{:​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 107:
    
 ===== 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
  
  • Admin
  • Last modified: 2018/05/11 12:14
  • by Eric Leu