If you are using mod_lsapi in a CloudLinux environment, enhancing its performance can be beneficial for your applications.
What is mod_lsapi?
mod_lsapi is an Apache module that allows for efficient handling of PHP applications. It leverages the LiteSpeed API (LSAPI) to provide high performance and scalability for PHP scripts by optimizing the way requests are processed. This module is particularly useful in shared hosting environments, where resource optimization is critical. On our hosting platform, all web servers use mod_lsapi as default.
Solution
To improve LSAPI performance, consider using one of the following methods:
- CRIU: Checkpoint/Restore In Userspace (CRIU) allows you to freeze a running application and restore it later, which can lead to faster performance and reduced memory usage.
- lsapi_with_connection_pool: This mode can be enabled in the
lsapi.conffile. Whenpool_modeis enabled,mod_lsapimaintains persistent connections with the back end, significantly increasing performance by accelerating request processing. However, it also increases the number of processes in LVE (Lightweight Virtual Environment) and memory usage.
Considerations
While enabling connection pooling can enhance performance, be aware that it may lead to higher memory consumption. On the other hand, using CRIU can provide a faster alternative with lower memory usage.
By utilizing either CRIU or enabling connection pooling in mod_lsapi, you can significantly improve the performance of your PHP applications in a CloudLinux environment.