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:
- Login to your server via SSH or console, as the root or priveledged user
- Edit the lsapi.conf file
- Find the line that reads
Then uncomment it (eg remove the prepending #) and append the word On, for example
- Now save the file (Ctrl + x, then y if you're using nano)
- Finally, restart Apache
systemctl httpd restart
And that's it! You're all done.