CloudLinux - CloudLinux Blog - mod_lsapi, alt-php and EA4 updated - CRIU support added
RSS

mod_lsapi, alt-php and EA4 updated - CRIU support added

mod_lsapi, alt-php and EA4 updated - CRIU support added

mod_lsapi version 1.1-1 for CloudLinux 7 as well as Alt-PHP and EA4 packages with CRIU support are available for download from our updates-testing repository.

Changelog: 

mod_lsapi-1.1-1  

alt-php70-7.0.14-2

alt-php56-5.6.29-2

ea-php56-5.6.29-1.cloudlinux.2

ea-php70-7.0.14-1.cloudlinux.3

  • implemented CRIU support.

What is CRIU

CRIU is Checkpoint/Restore In Userspace, or CRIU (pronounced kree-oo) is a software tool for Linux operating system. Using this tool, you can freeze a running application (or part of it) and checkpoint it as a collection of files on disk. You can then use the files to restore the application and run it exactly as it was during the time of freeze (more information on the link https://criu.org/Main_Page).

mod_lsapi-1.1-1 is the first beta version with freezing PHP implemented. mod_lsapi now supports the following parameters:

Option name Description Values Default
lsapi_criu Enable/disable CRIU for lsphp freezing On/Off Off
lsapi_criu_socket_path Set path to socket for communication with CRIU service [path to socket] /var/run/criu/criu_service.socket
lsapi_backend_semtimedwait Enable/disable flag for notification about lsphp started. This method avoids cycles of waiting for lsphp start On/Off Off
lsapi_backend_initial_start Number of requests when lsphp should be freezed

[number]

0 - no freezing
0
lsapi_criu_use_shm Method of requests counting. Off - use shared memory. Signals - use signals from child processes to parent off, signals off
lsapi_criu_imgs_dir_path Path to folder where imgs of freezed PHP will be stored [path] /var/run/mod_lsapi/
 
Example:
 
lsapi_criu On

lsapi_criu_socket_path /var/run/criu/criu_service.socket

lsapi_backend_semtimedwait On

lsapi_backend_initial_start 15

lsapi_criu_use_shm Off

How it works

When Apache module mod_lsapi detects CRIU enabled (lsapi_criu On) it prepares a directory for images (on the first request of virtualhost) to store (lsapi_criu_imgs_dir_path /var/run/mod_lsapi/[dir_name]), and starts lsphp process. Lsphp increases counter (lsapi_criu_use_shm Off|Signals) via shared memory or signals, when counter reaches limit (lsapi_backend_initial_start 15), lsphp sends the request to CRIU for freezing. CRIU service makes images of requested processes. Lsphp will not be frozen if counter has not reached limit. The next time when lsphp will be stopped, it will be unfrozen from the images.

The images of the processes will be saved even if Apache is restarted. But all images will be deleted after server restart by default configuration. This can be modified by setting the new path lsapi_criu_imgs_dir_path.

Important! If php.ini or configuration file from php.d is changed, the images must be deleted manually. We are working on automation of this action.

Note that CRIU can not correctly freeze lsphp with PrivateTmp enabled. For correct work PrivateTmp should be false in httpd.service file. For example:

# cat httpd.service

[Unit]

Description=Apache web server managed by cPanel EasyApache

ConditionPathExists=!/etc/httpddisable

ConditionPathExists=!/etc/apachedisable

ConditionPathExists=!/etc/httpdisable

[Service]

Type=forking

ExecStart=/usr/local/cpanel/scripts/restartsrv_httpd --no-verbose

PIDFile=/var/run/apache2/httpd.pid

PrivateTmp=false

[Install]

WantedBy=multi-user.target

Here is a testing of the first start of mod_lsapi with CRIU.

Environment: mod_lsapi + CRIU + wordpress + opcache, images were created on the 5th request.

Here is a testing of the first start of mod_lsapi with CRIU.

Environment: mod_lsapi + CRIU + wordpress + opcache, images were created on the 5th request.

2016 12 15

Graph shows response time of the index page for the wordpress site for the first request (and second request with opcache). The first bar shows the response time without CRIU (the worst time). The last bar shows the response of the second request (the ideal case, lsphp not stopped and instructions are opcached). The semaphores enabling shows start time decreasing, but with the CRIU  - it is close to the ideal case.

How to install (cPanel EA3, EA4 and RPM based systems only)

Control panels and configuration that currently support mod_lsapi+CRIU:

  1. RPM based panels (Plesk or clean OS) + alt-php56 or alt-php70

  2. cPanel EasyApache 3 + alt-php56 or alt-php70

  3. cPanel EasyApache 4 + + alt-php56 or alt-php70 or ea-php56 or ea-php70

First update alt-php or ea-php for EasyApache 4:

Alt-php should be higher or equal to:

alt-php56-5.6.29-2

alt-php70-7.0.14-2

Ea-php should be higher or equal to:

ea-php56-5.6.29-1.cloudlinux.2

ea-php70-7.0.14-1.cloudlinux.3

For updating alt-php with freezing support:

yum groupupdate alt-php --enablerepo=cloudlinux-updates-testing 

For install alt-php with freezing support:

yum groupinstall alt-php --enablerepo=cloudlinux-updates-testing

For updating ea-php(EasyApache 4) with freezing support:

yum-config-manager --enable cl-ea4-testing
yum update ea-php* --enablerepo=cloudlinux-updates-testing 
yum-config-manager --disable cl-ea4-testing

For install ea-php(EasyApache 4) with freezing support:

yum-config-manager --enable cl-ea4-testing

Install via web-interface or yum install ea-php* --enablerepo=cloudlinux-updates-testing

yum-config-manager --disable cl-ea4-testing

mod_lsapi installation and update:

cPanel EasyApache 3 & RPM Based:

$ yum update liblsapi liblsapi-devel --enablerepo=cloudlinux-updates-testing
$ yum update mod_lsapi --enablerepo=cloudlinux-updates-testing
$ service httpd restart

Installation for EasyApache 4:

To update:

$ yum update ea-apache24-mod_lsapi liblsapi liblsapi-devel --enablerepo=cloudlinux-updates-testing --enablerepo=cl-ea4-testing
$ service httpd restart

To install:

yum-config-manager --enable cl-ea4-testing
yum update liblsapi liblsapi-devel --enablerepo=cloudlinux-updates-testing

read http://docs.cloudlinux.com/index.html?cpanel_easyapache_4.html

yum-config-manager --disable cl-ea4-testing

DirectAdmin installation/update:

cd /usr/local/directadmin/custombuild
./build update
./build set cloudlinux_beta yes
./build mod_lsapi
./build php d

CRIU activating:

systemctl enable criu
systemctl start criu

Add the following strings to /etc/apache2/conf.d/lsapi.conf or /usr/local/apache/conf/lsapi.conf or /etc/httpd/conf.d/lsapi.conf:

lsapi_criu On

lsapi_criu_socket_path /var/run/criu/criu_service.socket

lsapi_backend_semtimedwait On

lsapi_backend_initial_start 15

lsapi_criu_use_shm Off

And restart apache.

What did 47% of hosting experts said they lack mos...
The KernelCare Update: The patch to fix CVE-2016-8...
 

Comments 6

Guest - Tommy on Friday, 16 December 2016 05:55

Impressive! Will wait for automatic deletes before implementing, but it looks very promising indeed.

Impressive! Will wait for automatic deletes before implementing, but it looks very promising indeed.
Guest - odmin on Friday, 16 December 2016 16:03

you are geeks!

you are geeks! ;)
Guest - Georgi Vasilev on Monday, 02 January 2017 13:41

Hello,
when criu will be available for cloudlinux 6?

Hello, when criu will be available for cloudlinux 6?
carpinteyrolxc carpinteyroxxnYU on Tuesday, 03 January 2017 12:21

Hi Georgi,
CRIU will not be supported for CL6, but most probably will be supported for CL7 Hybrid for CL6.
Please follow the updates.

Hi Georgi, CRIU will not be supported for CL6, but most probably will be supported for CL7 Hybrid for CL6. Please follow the updates.
Guest - Fahad Ur Rehman on Friday, 18 October 2019 08:01

I have Cloudlinux 7, I was looking to enable CRIU support but found the following warnings on this https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cloudlinux:lsphp_criu_enable

IMPORTANT!! CRIU may cause stability issues! Enable CRIU AT YOUR OWN RISK!

We have received quite a few reports that potential bugs on the CRIU module may cause web server stability issues. Please permanently disable CRIU, or enable CRIU AT YOUR OWN RISK.

I am not using Litespeed, just want to confirm if CRIU support is stable enough to use ?

I have Cloudlinux 7, I was looking to enable CRIU support but found the following warnings on this https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cloudlinux:lsphp_criu_enable IMPORTANT!! CRIU may cause stability issues! Enable CRIU AT YOUR OWN RISK! We have received quite a few reports that potential bugs on the CRIU module may cause web server stability issues. Please permanently disable CRIU, or enable CRIU AT YOUR OWN RISK. I am not using Litespeed, just want to confirm if CRIU support is stable enough to use ?
Sergey Khristich on Friday, 18 October 2019 09:39

Hello Fahad! Thank you for reaching out! This warning applies only to Litespeed Web Server. We recommend that you contact Litespeed with this question since CRIU on CloudLinux with Apache works well. Our announcement about the guarantees of CRIU performance on Apache and if there are errors in working with this, we will fix it. Please let us know if you have any questions. Thanks in advance!

Hello Fahad! Thank you for reaching out! This warning applies only to Litespeed Web Server. We recommend that you contact Litespeed with this question since CRIU on CloudLinux with Apache works well. Our announcement about the guarantees of CRIU performance on Apache and if there are errors in working with this, we will fix it. Please let us know if you have any questions. Thanks in advance!
Already Registered? Login Here
Guest
Saturday, 29 February 2020

Captcha Image