Many folks out there believe OpenLiteSpeed (OLS) is only good for small VPS setups, but that’s not always the case. While it’s true that Enterprise LiteSpeed (ELS) gives you more control and power, OLS, when properly optimized, can hold its own—especially for those looking to save a little extra cash. With the right tweaks, OLS can offer impressive performance without the need for a big-budget ELS license.

Enhance Control Panel, one of the few control panels that supports OpenLiteSpeed out of the box, makes it even easier to tap into OLS’s great performance.

Important Note:
For smaller servers or VPS setups, Enhance’s default configurations are more than sufficient, and no additional changes are needed. These settings are not recommended for small servers or VPS setups. They are best suited for larger servers with at least 250GB of RAM, 50+ CPUs, and ample I/O resources.

Also, before diving into the settings below, remember to always back up your current setup. You can do this with the following command inside your OpenLiteSpeed Docker container:
 
docker exec openlitespeed cp -a /usr/local/lsws/conf/httpd_config.conf /usr/local/lsws/conf/httpd_config_backup.conf

If you’re using the upcoming Enhance version 12 or higher, which drops Docker containers, you probably can run the backup command directly on your server like this:

 
cp -a /usr/local/lsws/conf/httpd_config.conf /usr/local/lsws/conf/httpd_config_backup.conf

As always, test these changes in a staging environment first, as every server setup is different. What works for us might not necessarily work for you, and we can’t be responsible for any issues on your end.

If you’re not interested in the details and are simply looking for the settings, here’s a quick configuration guide:

 
Server Configuration > General > Number of Workers = 16
Server Configuration > General > CPU Affinity = 1
Server Configuration > General > Memory I/O Buffer = 512M
Server Configuration > Tuning > Max Connections = 100000
Server Configuration > Tuning > Max SSL Connections = 100000
Server Configuration > Tuning > Send Buffer Size (bytes) = 512K
Server Configuration > Tuning > Receive Buffer Size (bytes) = 512K
Server Configuration > Tuning > Total Small File Cache Size (bytes) = 512M
Server Configuration > Tuning > Max MMAP File Size (bytes) = 64M
Server Configuration > Tuning > Total MMAP Cache Size (bytes) = 512M
Server Configuration > Tuning > Use Asynchronized disk I/O (AIO) = io_uring
Server Configuration > Tuning > AIO Block Size = 512K
Server Configuration > External App > LiteSpeed SAPI App > Max Connections = 500
Server Configuration > External App > LiteSpeed SAPI App > Environment > PHP_LSAPI_CHILDREN=500
Server Configuration > External App > LiteSpeed SAPI App > Environment > LSAPI_AVOID_FORK=0

Simply apply these settings to get started right away.

 

OpenLiteSpeed Optimization Script with Zero Resource Impact

 
https://gist.github.com/cPFence/d829366b95f8abd4d4ac2501b7be425d#file-ols_optimize-sh
 
This script automatically applies the recommended optimizations for OpenLiteSpeed mentioned above. Simply download the script, configure it to your preferences, and set it to run via a cron job every minute. The script will monitor your OLS config file and will only run when changes are detected, resulting in zero impact on CPU and RAM usage.
 
Example Cron Job:
* * * * * /path/to/your/ols_optimize.sh

 
Please ensure to test the script in a non-production environment before deploying it on any live or critical systems.

 

For those who want to dive into the details, keep reading as we explain the reasoning behind each setting and how they can enhance performance for your OLS-powered Enhance server or any other control panel.
 
Login to OpenLiteSpeed (OLS) Panel:
 
If you’re using Enhance servers and need to log in to the OLS panel, use the following URL:
 

https://my.serverdomain.com:7080/login.php

 

If you don’t have the password, you will need to reset it from the SSH terminal. For more details on how to reset your OpenLiteSpeed admin password on Enhance servers, read more here.
Once you are logged in, you can proceed with the following changes and tweaks.

1. Server Configuration > General > Number of Workers = 16

Why?
This setting controls how many worker processes OpenLiteSpeed will spawn. Setting it to 16 ensures efficient use of CPU resources in large servers with many CPU cores. More workers allow handling more requests concurrently.

Benefits:
Allows better parallel processing for large workloads.


2. Server Configuration > General > CPU Affinity = 1

Why?
Binding each worker process to a specific CPU core improves performance by ensuring that the process can reuse data cached in the core’s memory. Setting CPU Affinity to 1 ensures better cache utilization.

Benefits:
Optimizes CPU cache use, reducing overhead and improving performance.


3. Server Configuration > General > Memory I/O Buffer = 512M

Why?
A larger I/O buffer helps prevent disk swapping by ensuring enough memory is available to store incoming requests and their dynamic responses. Setting it to 512M improves the server’s ability to handle a large volume of requests without hitting disk I/O.

Benefits:
Prevents memory-to-disk swapping and improves throughput for large workloads.


4. Server Configuration > Tuning > Max Connections = 100,000

Why?
This setting determines the maximum number of concurrent connections that OLS can handle. For a large shared hosting server, setting this to 100,000 ensures that the server can handle high traffic without prematurely closing connections.

Benefits:
Accommodates a high number of concurrent users, ensuring smooth operation during peak times.


5. Server Configuration > Tuning > Max SSL Connections = 100,000

Why?
Since most websites are now served over HTTPS, it’s important that the server can handle a large number of SSL connections. Setting this to 100,000 matches the max connections value and ensures no bottlenecks when serving secure traffic.

Benefits:
Supports a high volume of secure connections, essential for modern websites.


6. Server Configuration > Tuning > Send Buffer Size (bytes) = 512K

Why?
This controls the buffer size used for sending data to clients. Increasing this to 512K helps with throughput when sending large static files or high volumes of traffic, making file transfers faster and more efficient.

Benefits:
Improves the performance of large file transfers and reduces socket congestion.


7. Server Configuration > Tuning > Receive Buffer Size (bytes) = 512K

Why?
Similar to the send buffer, this controls the buffer size for receiving data from clients. Setting this to 512K helps when dealing with large uploads or incoming traffic, allowing the server to handle more data without delays.

Benefits:
Optimizes performance for large file uploads and heavy incoming data streams.


8. Server Configuration > Tuning > Total Small File Cache Size (bytes) = 512M

Why?
Small static files are often requested frequently. Caching them in memory ensures they can be served quickly without hitting the disk. Setting 512M for this cache size ensures that more small files can be cached, reducing disk I/O.

Benefits:
Faster delivery of small static files and reduced disk access, improving response times.


9. Server Configuration > Tuning > Max MMAP File Size (bytes) = 64M

Why?
Files larger than the small file cache but smaller than this value will be memory-mapped, allowing them to be served directly from memory. Setting this to 64M ensures that medium-sized files are efficiently served without using too much memory.

Benefits:
Improves performance for medium-sized files without overwhelming memory resources.


10. Server Configuration > Tuning > Total MMAP Cache Size (bytes) = 512M

Why?
This determines how much memory is allocated for the memory-mapped file cache. Setting 512M ensures there is enough memory to cache a good amount of medium-sized files, improving performance when serving these files.

Benefits:
Reduces disk access for medium-sized files, improving load times for commonly requested content.


11. Server Configuration > Tuning > Use Asynchronized Disk I/O (AIO) = io_uring

Why?
Using io_uring provides more efficient asynchronous I/O, reducing I/O wait times and improving performance for disk-heavy workloads. It is the most efficient AIO method available on modern Linux systems.

Benefits:
Improves overall server performance by reducing disk I/O bottlenecks, especially under high load.


12. Server Configuration > Tuning > AIO Block Size = 512K

Why?
This controls the block size used for asynchronous disk I/O. Setting it to 512K allows larger chunks of data to be processed at once, which is beneficial for large file transfers and disk I/O-heavy operations.

Benefits:
Enhances disk I/O performance, reducing wait times for large data transfers.


13. Server Configuration > External App > LiteSpeed SAPI App > Max Connections = 500

Server Configuration > External App > LiteSpeed SAPI App > Environment > PHP_LSAPI_CHILDREN=500

Server Configuration > External App > LiteSpeed SAPI App > Environment > LSAPI_AVOID_FORK=0

Why?
This controls how many concurrent connections OpenLiteSpeed can make to LSPHP, which processes PHP requests. Setting this to 500 ensures that PHP requests can be processed concurrently without overwhelming the PHP handler. Also on a shared hosting server , it’s beneficial to set LSAPI_AVOID_FORK=0 To save system resources, it will stop processes when they finish and only start child processes when they are needed. This is often preferred in shared hosting.

Benefits:
Allows concurrent PHP requests to be processed efficiently without overloading the PHP processor, improving response times.


Conclusion

By adjusting these settings, OpenLiteSpeed can be optimized to handle the demands of a large shared hosting environment. Remember, these settings should be used as a starting point, and you should always test them in your environment before applying them in production.

Important: These optimizations are designed for large servers with ample resources, not for smaller VPS setups.

 

Think one of the settings could be better, or did we get something wrong? Drop your thoughts in the comments and let us know how we can improve.

 

Want to Secure your OLS Powered Enhance Server? Try cPFence for free!

If you’re looking for top-notch security tailored for your Enhance server, look no further than cPFence. Designed specifically for Enhance environments and highly optimized for OpenLiteSpeed (OLS) and LiteSpeed (LS) servers, cPFence delivers powerful protection without sacrificing performance. Whether you’re running a small setup or managing larger server farms, cPFence ensures your server stays secure and fast. Don’t settle for less when it comes to safeguarding your system—try cPFence today for free and experience reliable, optimized security firsthand.

 

No comment

Leave a Reply

Your email address will not be published. Required fields are marked *