Enable Connection Pool mode for LSAPI with cPanel and CloudLinux Print

  • 0

If you're running a cPanel + WHM server atop the CloudLinux OS, you're probably already using its amazing features including LVE, CageFS and LSAPI for PHP processing. But it's possible to take LSAPI one step further from the default configuration, and that's to enable the Connection Pool mode. 

In its default state, LSAPI will spawn a parent process handler, then individiually spin up child workers per configured domain. The problem with this configuration is that it's not very efficient on CPU, RAM or things like OpCache. Plus, because each child worker is spun down, the TTFB (Time To First Byte) is increased per connection.

Connection Pools allow the LSAPI master worker to hold a continuous connection with Apache, and keep a centralised OpCache pool per configured domain. This leads to a great improvement in TTFB response times and overall processing speed. To enable it, we need to:

  1. Login to your server via SSH or console, as the root or priveledged user

  2. Edit the lsapi.conf file

    nano /etc/apache2/conf.d/lsapi.conf

  3. Find the line that reads

    # lsapi_with_connection_pool

    Then uncomment it (eg remove the prepending #) and append the word On, for example

    lsapi_with_connection_pool On

  4. Now save the file (Ctrl + x, then y if you're using nano)

  5. Finally, restart Apache

    systemctl httpd restart


And that's it! You're all done.

Was this answer helpful?

« Back