Skip to main content

OpenLiteSpeed

OpenLiteSpeed (OLS) is the open-source edition of LiteSpeed Web Server and a strong choice for WordPress on a VPS. It combines high-performance PHP handling (LSAPI), Apache-style rewrite compatibility, and an ecosystem built around LSCache.

Quick Summary
  • OLS is a practical middle ground: high performance like Nginx, .htaccess compatibility like Apache.
  • Most operational tasks come down to: listeners, virtual hosts, PHP handler, and logs.
  • Treat config edits like deployments: edit, validate, reload, verify with a single request.

Virtual hosts and domains

OLS uses virtual hosts to map domains to docroots, PHP handlers, and SSL settings. If you're hosting multiple WordPress sites, a clean vhost layout is the difference between "works once" and "repeatable ops".

Why OpenLiteSpeed (OLS)?

OLS is the open-source edition of LiteSpeed Web Server (LSWS Enterprise).

  • Free: No license cost, unlike LSWS Enterprise.
  • Performance: Faster than Apache, comparable (often better) than Nginx for PHP/WordPress.
  • LSAPI (LiteSpeed API for PHP): Handles PHP much faster than PHP-FPM.
  • Built-in LSCache: Free full-page caching engine (when paired with WordPress LSCache plugin).
  • HTTP/2 + QUIC/HTTP3: Modern protocols built-in.
  • Apache compatibility: Reads .htaccess, unlike Nginx.
  • Great for WordPress: Auto-tuned for PHP + cache integration.

In short: OLS = Nginx-level speed + Apache flexibility + Free LSCache.


OpenLiteSpeed structure (CLI focus)

OLS keeps everything in /usr/local/lsws/.

PathPurposeTunable Areas
/usr/local/lsws/conf/httpd_config.confMain server configListeners, tuning, logging, global cache
/usr/local/lsws/conf/vhosts/Virtual Host configsPer-domain docRoot, PHP, cache, SSL
/usr/local/lsws/conf/cert/SSL certs storageTLS settings
/usr/local/lsws/logs/Server-wide logsLog rotation, error analysis
/usr/local/lsws/admin/conf/Admin server config (can ignore if CLI-only)N/A
/usr/local/lsws/bin/Control scriptsRestart, reload, version check

Main config structure

httpd_config.conf

Global OLS config file.

Key sections:

  • Listeners → Which ports/IPs OLS listens to.
  • Virtual Host Mappings → Assign domains to listeners.
  • Tuning → Buffers, connection limits, gzip, QUIC.
  • Logging → Global error logs.

Example snippet:

httpd_config.conf snippet (example)
user nobody
group nogroup
adminEmails you@example.com

errorlog /usr/local/lsws/logs/error.log
logLevel INFO

listener Default {
address *:80
secure 0
vhost domain.com domain.com
}


Virtual hosts (/usr/local/lsws/conf/vhosts/DOMAIN/vhconf.conf)

Per-domain settings (similar to Apache vhost).

Tunables:

  • docRoot → WordPress root dir.
  • index → Default files (index.php).
  • phpIniOverride → Memory limit, upload size.
  • vhssl → SSL/TLS config.
  • cache → Enable LSCache.

Example:

vhconf.conf snippet (example)
docRoot /var/www/domain.com/html
index {
useServer 0
indexFiles index.php, index.html
}
phpIniOverride {
memory_limit 512M
upload_max_filesize 256M
post_max_size 256M
}


Listeners (inside httpd_config.conf)

Connects ports to vhosts.

  • Port 80 → HTTP
  • Port 443 → HTTPS

Example:

listener definitions (example)
listener HTTP {
address *:80
secure 0
vhost domain.com domain.com
}
listener HTTPS {
address *:443
secure 1
vhost domain.com domain.com
}


SSL, QUIC, and HTTP/2 tuning

Inside vhost vhssl block:

vhssl block (example)
vhssl {
keyFile /etc/letsencrypt/live/domain.com/privkey.pem
certFile /etc/letsencrypt/live/domain.com/fullchain.pem
sslProtocol 24
enableECDHE 1
enableStapling 1
}

Inside listener:

listener protocol flags (example)
enableSpdy 15
enableQuic 1


Cache config (LSCache at vhost level)

cache block (example)
cache {
enableCache 1
checkPrivateCache 1
checkPublicCache 1
}

WordPress: Install LiteSpeed Cache Plugin, matches server cache.


Tuning section (inside httpd_config.conf)

Controls server performance:

tuning block (example)
tuning {
maxConnections 5000
maxSSLConnections 2000
connTimeout 300
maxKeepAliveReq 1000
keepAliveTimeout 60
sndBufSize 256K
rcvBufSize 256K
gzipCompressLevel 6
gzipMaxFileSize 1M
}

What you can tune:

  • maxConnections: VPS RAM/CPU capacity.
  • gzipCompressLevel: Balance between CPU load and size reduction.
  • sndBuf/rcvBuf: Bigger buffer = faster static file serving.

CLI management

CommandPurpose
systemctl status lswsCheck OLS status
systemctl restart lswsRestart OLS after config change
/usr/local/lsws/bin/lswsctrl reloadReload without downtime
/usr/local/lsws/bin/lshttpd -vCheck version
tail -f /usr/local/lsws/logs/error.logLive error log

Safe change workflow

Treat OLS config edits like a small deployment. Use a repeatable workflow so a bad change does not become a long outage.

  1. Identify the file you are changing (global vs vhost).
  2. Take a quick backup copy.
  3. Make the smallest possible change.
  4. Reload (preferred) or restart (when required).
  5. Verify with a single request and the error log.
backup-httpd-config.conf.sh
sudo cp -a /usr/local/lsws/conf/httpd_config.conf \
"/usr/local/lsws/conf/httpd_config.conf.$(date +%F_%H%M%S).bak"

Reload without a full restart:

reload-lswsctrl.sh
sudo /usr/local/lsws/bin/lswsctrl reload

Watch the error log during the change window:

tail-ols-error-log.sh
sudo tail -n 200 /usr/local/lsws/logs/error.log
warning

Reloading/restarting the wrong service (or applying an invalid config) can drop connections. Make changes off-peak and keep an active SSH session before you reload.


Why OLS is tunable and a strong free choice

Unlike Apache/Nginx:

  • Apache = Flexible but slower, heavy on RAM.
  • Nginx = Fast but lacks .htaccess & LSCache.
  • OLS = Best of both worlds:
    • Reads .htaccess rules.
    • Native LSCache engine (WordPress optimized).
    • QUIC + HTTP/2 support by default.
    • Tunable directly in config files without extra modules.

Quick lab: minimal optimized virtual host

quick-lab-create-docroot-and-phpinfo.sh
mkdir -p /var/www/example.com/{html,logs}
echo "<?php phpinfo(); ?>" > /var/www/example.com/html/index.php

/usr/local/lsws/conf/vhosts/example.com/vhconf.conf:

vhconf.conf (example)
docRoot /var/www/example.com/html
index {
useServer 0
indexFiles index.php, index.html
}
phpIniOverride {
memory_limit 512M
}
cache {
enableCache 1
}

Map in /usr/local/lsws/conf/httpd_config.conf:

httpd_config.conf listener map (example)
listener Default {
address *:80
vhost example.com example.com
}

Reload:

restart-lsws.sh
systemctl restart lsws


Cheat sheet

TaskFile/Command
Global config/usr/local/lsws/conf/httpd_config.conf
Virtual hosts/usr/local/lsws/conf/vhosts/DOMAIN/vhconf.conf
Logs/usr/local/lsws/logs/
Restart OLSsystemctl restart lsws
Reload without downtime/usr/local/lsws/bin/lswsctrl reload

With this structure, you know exactly where to tune OLS for performance and security — all via CLI.


The next sections provide a practical tuning guide. Focus on the few levers that matter (connections, LSAPI children, cache policy, compression, TLS) and validate changes with a repeatable test.


Fine-tuning guide (production baseline)

Fine-tuning OpenLiteSpeed (OLS) is most effective when you tune one layer at a time and keep rollback options. Start with safe defaults, confirm logging/metrics, then tune: OLS -> PHP LSAPI -> cache -> TLS -> database -> OS.


Core OLS configuration

  • Worker Processes & Connections
    • Adjust in WebAdmin → Server Config → Server Process → General Settings.
    • Max Connections: Set based on expected concurrent users (e.g., 2,000+ for WooCommerce).
    • Max SSL Connections: Tune if heavy HTTPS.
    • LSAPI_CHILDREN (PHP): Match your vCPU count × 2 to avoid overload.
  • Event Dispatcher
    • Keep default “epoll” (Linux kernel best for high concurrency).
    • Set CPU Affinity if dedicating CPU cores.

PHP LSAPI tuning

  • Use LiteSpeed SAPI (lsphp) instead of php-fpm for lower overhead.

  • Key directives (/usr/local/lsws/conf/php.ini or via WebAdmin):

    • lsapi_backend_children: Number of PHP workers.
    • maxConnections: Match concurrency demand.
    • PHP memory_limit: Adjust (256M–512M for WooCommerce).
  • Enable OPcache:

    opcache-recommended.ini
    opcache.enable=1
    opcache.memory_consumption=256
    opcache.max_accelerated_files=20000


Caching

  • LSCache Plugin (WordPress):
    • Enable Public + Private Cache.
    • Enable Object Cache (Redis/Memcached).
    • Enable Crawler (pre-warms cache).
  • Static File Cache:
    • Set expiration in WebAdmin → Virtual Hosts → Static Contexts.
    • Example: images/css/js expire in 7d–30d.

Compression and Brotli

  • Enable Brotli (preferred) or gzip in OLS.
  • Check: WebAdmin → Server Config → Tuning → Compression.
  • Use Brotli level 4–6 (balance CPU vs performance).

TLS and SSL tuning

  • Enable HTTP/2 + QUIC/HTTP/3 in listener settings.
  • TLS cipher suite: prefer modern (TLS_AES_128_GCM_SHA256, etc.).
  • Enable OCSP Stapling to reduce handshake latency.

MariaDB and database layer

  • Install MariaDB 10.6+ (better InnoDB performance).

  • Key configs (/etc/mysql/my.cnf):

    innodb_buffer_pool_size = 2G # 50-70% of server RAM
    innodb_log_file_size = 512M
    query_cache_type = 0
    max_connections = 200

  • Pair with Redis object cache (via LSCache).


System-level optimizations

  • ulimit: increase open files (ulimit -n 65535).

  • TCP tuning (/etc/sysctl.conf):

    net.core.somaxconn = 65535
    net.ipv4.tcp_tw_reuse = 1
    net.ipv4.tcp_fin_timeout = 15

  • Use NVMe storage for DB/data.


Monitoring and logs

  • Use htop, top, iostat, vmstat to monitor OLS processes.
  • Enable Real-time Stats in OLS WebAdmin.
  • Use Access Logs + Gzip log rotation.

Best practices

  • Scale PHP workers to CPU capacity (avoid swap).
  • Use CDN (Cloudflare APO) for global distribution.
  • Benchmark with:
    • ab -n 10000 -c 500 https://domain.com/
    • wrk -t4 -c400 -d30s https://domain.com/
  • Continuously monitor error.log for LSAPI timeouts.

With these, OLS can easily handle 5–10x more requests per second than Apache/Nginx on the same VPS, especially when paired with LSCache and Redis.


Deep dive: core OpenLiteSpeed configuration and PHP LSAPI tuning. This section focuses on the settings that most directly affect concurrency, stability, and tail latency.


Core OLS configuration (deep dive)

a) Worker Processes & Connections

  • OLS is event-driven, so usually 1 worker process is enough unless you’re running multiple listeners.
  • Adjust in WebAdmin → Server Configuration → Server Process → General Settings:
SettingRecommended ValueWhy
Max Connections2,000 – 10,000 (depending on RAM)Controls simultaneous connections.
Max SSL Connections~70–80% of Max ConnectionsTLS handshakes use more CPU.
Connection Timeout30s (default)Drop idle clients to free resources.
Keep-Alive Timeout5–10sKeeps connections alive but not too long.

Example: for a 2vCPU / 4GB VPS:

  • Max Connections: 2000
  • Max SSL Connections: 1500
  • Keep-Alive: 7

b) Event Dispatcher

  • Found at WebAdmin → Server Configuration → Server Process → General Settings.
  • Default = epoll (best on Linux). Don’t change unless debugging.
  • CPU Affinity:
    • If dedicated VPS, bind OLS to all CPU cores.
    • Example: 0,1 for 2 cores.

c) File Descriptor & Process Limits

Set system-wide:

set-ulimit-open-files.sh
ulimit -n 65535

Add to /etc/security/limits.conf:

/etc/security/limits.conf (example)
* soft nofile 65535
* hard nofile 65535

This prevents Too many open files errors under load.


PHP LSAPI Tuning

OLS uses lsphp (LiteSpeed SAPI) instead of php-fpm.

You tune it at WebAdmin → Server Configuration → External App → LSAPI App.


a) PHP Workers (lsapi_backend_children)

  • Formula: 2 × vCPU count
  • Example:
    • 2 vCPU → 4 PHP workers
    • 4 vCPU → 8 PHP workers

This balances CPU load without overload.


b) PHP Connections

  • Max Connections = number of PHP workers (lsapi_backend_children).
  • Example: 4 workers → Max Connections = 4.
  • Prevents OLS from overloading PHP with too many requests at once.

c) Memory & Execution

Edit /usr/local/lsws/lsphpXX/etc/php.ini:

memory_limit = 256M
max_execution_time = 120
post_max_size = 64M
upload_max_filesize = 64M

WooCommerce or heavy sites may need 512M.


d) OPcache

Enable caching at PHP level:

opcache.enable=1
opcache.memory_consumption=256
opcache.max_accelerated_files=20000
opcache.validate_timestamps=1
opcache.revalidate_freq=2

  • Speeds up PHP response by keeping bytecode in memory.
  • 20000 files is safe for large WordPress sites.

e) LSAPI Options

In WebAdmin → External App → lsphp:

OptionValueWhy
Max Idle Time60sKill idle PHP to save RAM.
Initial Request Timeout60Prevent hanging PHP requests.
Retry Timeout0Don’t retry dead processes.
EnvironmentPHP_INI_SCAN_DIRPoint to tuned php.ini.

Do several scenario editing base on vps spec, trafic

Tuning choices depend on VPS hardware (CPU/RAM) and expected traffic. Use the scenarios below as starting points, then adjust based on real measurements (latency, error rates, and resource saturation).

We’ll focus only on Point 1 (Core OLS Config) through CLI (/usr/local/lsws/conf/httpd_config.conf edits + ulimit/systemd).


Small VPS (2 vCPU / 4 GB RAM, low traffic ~20-50 concurrent users)

Edit:

serverConfig {
maxConnections 1000
maxSSLConnections 700
connTimeout 30
keepAliveTimeout 7
maxKeepAliveReq 500
eventDispatcher epoll
}

System limits:

LimitNOFILE=4096

Safe for small WooCommerce/blog with LSCache.


Mid VPS (4 vCPU / 8 GB RAM, medium traffic ~100-300 concurrent users)

serverConfig {
maxConnections 4000
maxSSLConnections 3000
connTimeout 30
keepAliveTimeout 7
maxKeepAliveReq 1000
eventDispatcher epoll
cpuAffinity 0,1,2,3
}

System limits:

LimitNOFILE=32768

Good for busy WooCommerce or membership site. Handles bursts without 502 errors.


Large VPS (8 vCPU / 16 GB RAM, heavy traffic ~500-1000 concurrent users)

serverConfig {
maxConnections 10000
maxSSLConnections 8000
connTimeout 20
keepAliveTimeout 5
maxKeepAliveReq 2000
eventDispatcher epoll
cpuAffinity 0,1,2,3,4,5,6,7
}

System limits:

systemd LimitNOFILE setting
LimitNOFILE=65535

Can handle ~20k–30k req/min with LSCache + Redis enabled.


Enterprise node (16 vCPU / 32 GB RAM, very high traffic ~2000+ concurrent users)

serverConfig {
maxConnections 20000
maxSSLConnections 16000
connTimeout 15
keepAliveTimeout 5
maxKeepAliveReq 3000
eventDispatcher epoll
cpuAffinity 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
}

System limits:

LimitNOFILE=65535

Typically paired with dedicated DB, Redis cluster, and CDN (Cloudflare APO).


How to apply via CLI

  1. Edit config:
edit-httpd-config.sh
nano /usr/local/lsws/conf/httpd_config.conf

Insert/adjust the serverConfig block per scenario.

  1. Edit systemd service:
edit-lsws-systemd-override.sh
systemctl edit lsws

Add:

lsws.service override (example)
[Service]
LimitNOFILE=65535

  1. Reload & restart:
reload-systemd-and-restart-lsws.sh
systemctl daemon-reexec
systemctl restart lsws

  1. Verify:
verify-open-files-limit.sh
cat /proc/$(pgrep lshttpd)/limits | grep "Max open files"


Rule of thumb

  • Small VPS → 1k connections
  • Medium VPS → 4k connections
  • Large VPS → 10k+ connections
  • Scale maxSSLConnections ≈ 70–80% of total.
  • Always align LimitNOFILE with maxConnections × 2.

Knowing the OpenLiteSpeed folder structure helps you locate configs, logs, and vhost definitions quickly from the CLI.

Here’s the default installation tree when OLS is installed in /usr/local/lsws/ (standard on Ubuntu/Debian/CentOS):


OpenLiteSpeed folder structure

openlitespeed-install-tree.txt
/usr/local/lsws/
├── admin/ # WebAdmin console files
│ ├── conf/ # Admin console config
│ └── html/ # Admin panel frontend

├── bin/ # OLS binaries (start, stop, restart)
│ ├── lswsctrl # Main control script
│ ├── lshttpd # Core web server process
│ └── lsphp # PHP wrapper binaries

├── cache/ # Internal cache storage (LSCache, private cache)

├── conf/ # Main server configs
│ ├── httpd_config.conf # Main OLS config (server-wide)
│ ├── mime.properties # MIME types
│ ├── vhosts/ # Virtual host configs
│ │ └── Example/ # Example vhost (default site)
│ │ ├── vhost.conf # Virtual host config
│ │ └── conf.d/ # Extra configs for vhost
│ └── modules/ # Module configs (e.g., cache, gzip)

├── fcgi-bin/ # FastCGI apps (rarely used)

├── logs/ # Server log files
│ ├── access.log
│ ├── error.log
│ └── stderr.log

├── php/ # PHP versions installed with lsphp
│ └── lsphpXX/ # Example: lsphp81/, lsphp82/
│ ├── bin/ # PHP binary
│ └── etc/ # php.ini, conf.d modules

├── DEFAULT/ # Default web root for Example vhost
│ └── html/ # Example index.html, 404 pages

├── share/ # OLS share files, man pages

├── tmp/ # Temporary runtime files (sockets, pid)

└── LICENSE # License file


Key locations you'll use

  • Main server config/usr/local/lsws/conf/httpd_config.conf
  • Virtual host config/usr/local/lsws/conf/vhosts/<your-vhost>/vhost.conf
  • Admin config/usr/local/lsws/admin/conf/admin_config.conf
  • Logs/usr/local/lsws/logs/
  • Web root (default)/usr/local/lsws/DEFAULT/html/
  • PHP configs/usr/local/lsws/lsphpXX/etc/php.ini

Handy commands

View structure in your server:

show-ols-directory-tree.sh
tree -L 2 /usr/local/lsws

If tree is not installed:

install-tree.sh
# Ubuntu/Debian
sudo apt update
sudo apt install -y tree

# CentOS/RHEL
sudo yum install -y tree


The next section maps the OpenLiteSpeed folder structure to what you can safely edit (and what you should avoid) when tuning a WordPress VPS.


Editable and optimizable files in OLS

Server configurations

  • /usr/local/lsws/conf/httpd_config.conf

    Main OLS config file

    • Worker process limits (maxConnections, keepAliveTimeout)

    • Event dispatcher (epoll)

    • Listeners (ports, SSL/TLS settings)

    • Global modules (gzip, Brotli, cache rules)

      Most important file to tune OLS performance

  • /usr/local/lsws/conf/mime.properties

    • Controls MIME types (e.g., .webpimage/webp)
    • Edit if you want to serve modern formats (WebP, AVIF).

Virtual host configurations

  • /usr/local/lsws/conf/vhosts/<vhost-name>/vhost.conf

    Per-site config file

    • Domain-specific tuning (cache, rewrites, SSL)

    • Contexts (static, dynamic, rewrite rules)

      Useful for WordPress-specific tuning (e.g., LSCache rules).

  • /usr/local/lsws/conf/vhosts/<vhost-name>/conf.d/

    • Extra configs per vhost (modular includes).
    • Often used for custom rewrites or app-specific tuning.

Admin console config

  • /usr/local/lsws/admin/conf/admin_config.conf
    • Controls OLS WebAdmin panel itself.
    • Change only if you need to adjust admin login port or IP restrictions.

PHP configurations (LSAPI)

  • /usr/local/lsws/lsphpXX/etc/php.ini

    PHP runtime tuning

    • memory_limit, max_execution_time, upload_max_filesize, post_max_size
    • Enable/optimize OPcache
  • /usr/local/lsws/conf/external-apps/ (or inside httpd_config.conf)

    • LSAPI settings for PHP apps.

    • lsapi_backend_children, maxConns, initTimeout

      Tune PHP workers and timeouts here.


Logs (monitoring and debugging)

  • /usr/local/lsws/logs/error.log
    • Watch for PHP/connection errors, LSAPI timeouts.
  • /usr/local/lsws/logs/access.log
    • Useful for traffic pattern analysis.

      Don’t edit, but review frequently when tuning.


Default document root

  • /usr/local/lsws/DEFAULT/html/
    • Holds default index page.
    • You can remove or replace for security (to avoid default OLS banner).

Cache configs

  • /usr/local/lsws/cache/
    • Stores LSCache data.
    • You normally don’t edit manually, but you can clear/reset cache here.

systemd and limits

  • /etc/systemd/system/lsws.service.d/override.conf (after systemctl edit lsws)

    • Set file descriptors:

      [Service]
      LimitNOFILE=65535

    Prevents “too many open files” under high traffic.


Files you should not edit

  • /usr/local/lsws/bin/ → Binaries (lswsctrl, lshttpd, lsphp)
  • /usr/local/lsws/share/ → Man pages, static resources
  • /usr/local/lsws/tmp/ → Runtime files, sockets, pid

Editing these can break OLS.


Summary: key files to edit for optimization

AreaFile
Global OLS tuning/usr/local/lsws/conf/httpd_config.conf
Per-site tuning/usr/local/lsws/conf/vhosts/<vhost>/vhost.conf
PHP runtime/usr/local/lsws/lsphpXX/etc/php.ini
PHP LSAPI workersinside httpd_config.conf → external-app block
MIME optimization/usr/local/lsws/conf/mime.properties
Limits/etc/systemd/system/lsws.service.d/override.conf

Should we optimize ols or setting it

Setting and optimizing are different activities. Use the next section to keep them separate.


OLS: optimizing vs setting

Setting OLS

  • This is the baseline configuration you must do after installing OLS.
  • Goal: Make it work correctly for your VPS and WordPress.
  • Examples:
    • Adding your domain & virtual host (vhost.conf)
    • Pointing doc root to /var/www/domain.com/public_html
    • Configuring SSL/TLS
    • Choosing PHP version (lsphp81, lsphp82, etc.)
    • Setting basic worker/connection values (maxConnections, keepAliveTimeout)

Think of this as “turning the engine on”. Without it, OLS won’t even serve your site properly.


Optimizing OLS

  • This comes after setting — it’s about squeezing performance, stability, and scalability.
  • Goal: Make it handle traffic better, run faster, and use fewer resources.
  • Examples:
    • Tuning PHP LSAPI workers (lsapi_backend_children, maxConns)
    • Enabling OPcache in PHP (php.ini)
    • Raising file descriptor limits (LimitNOFILE)
    • Adjusting maxConnections based on VPS size
    • Enabling Brotli/gzip compression
    • Optimizing SSL with HTTP/3, OCSP stapling
    • Matching MariaDB buffer pool size to RAM
    • Enabling LSCache + Redis object cache

This is “tuning the engine” so it runs smoothly at high speed without overheating.


Which one comes first?

Always set OLS first, then optimize.

  • Setting ensures your server runs and serves WordPress correctly.
  • Optimizing ensures it can scale, perform fast, and not crash under load.

Practical flow

  1. Set it up
    • Virtual hosts, SSL, PHP version, listeners.
  2. Optimize it
    • Worker processes, PHP workers, OPcache, caching, Brotli, sysctl, MariaDB.
  3. Benchmark & adjust
    • Use ab or wrk to simulate traffic.
    • Adjust configs if you hit bottlenecks.

So the short answer:

You need both — first setting OLS (basic config), then optimizing OLS (performance tuning).


Any correlation vps spc, db bufffer pool memory allocation, op cache setting with ols setting

These layers are coupled: VPS CPU/RAM constrains PHP concurrency, MariaDB memory allocation, and the OLS connection limits you can sustain. Tune them together (and validate after each change) instead of changing one layer in isolation.


Correlation between VPS specs and OLS stack tuning

VPS specs (CPU and RAM)

  • Determines the hard limits of how many requests you can handle.
  • Affects how many OLS connections and PHP workers you can run before hitting RAM/CPU bottlenecks.
  • Rule of thumb:
    • 2 vCPU / 4GB → small sites, ~1k connections, 4 PHP workers
    • 4 vCPU / 8GB → medium, ~4k connections, 8 PHP workers
    • 8 vCPU / 16GB → large, ~10k connections, 16 PHP workers

If you over-allocate beyond VPS spec, server swaps → performance crashes.


MariaDB InnoDB buffer pool

  • Buffer pool = “RAM cache” for DB queries.
  • Ideal size: 50–70% of total RAM (if DB runs on same VPS as OLS).
  • Example:
    • 4GB RAM VPS → 2GB buffer pool
    • 8GB RAM VPS → 4–5GB buffer pool
    • 16GB RAM VPS → 8–10GB buffer pool
  • If too small → more disk I/O → slow queries.
  • If too large → memory starvation for OLS/PHP → server OOM (out of memory).

Must balance with OLS worker memory + OPcache.


PHP OPcache

  • OPcache stores precompiled PHP code in memory.
  • Memory allocation must match codebase size (themes + plugins).
  • Rule of thumb:
    • Small WP site → 128M OPcache
    • WooCommerce / LMS → 256–512M OPcache
    • Enterprise / multisite → 512M–1G OPcache
  • opcache.max_accelerated_files should cover all PHP scripts (10k–40k).

If too low → cache misses, slow PHP.

If too high → starves RAM from MariaDB buffer pool.


OLS worker settings

  • maxConnections and PHP LSAPI workers must align with CPU cores.
  • Example:
    • 2 vCPU → 4 PHP workers, ~1000–2000 maxConnections
    • 4 vCPU → 8 PHP workers, ~4000 maxConnections
    • 8 vCPU → 16 PHP workers, ~10k maxConnections

Too many PHP workers → RAM exhaustion.

Too few → long request queues (502 errors).


How they interconnect

VPS SpecOLS SettingMariaDB Buffer PoolPHP OPcache
2 vCPU / 4GBmaxConnections = 1000–2000, 4 PHP workers2GB128–256M
4 vCPU / 8GBmaxConnections = 4000, 8 PHP workers4–5GB256–512M
8 vCPU / 16GBmaxConnections = 10,000, 16 PHP workers8–10GB512M–1G
16 vCPU / 32GBmaxConnections = 20,000+, 32 PHP workers16–20GB1G+

Practical example (4 vCPU / 8 GB VPS, WooCommerce)

  • OLS (httpd_config.conf)

    maxConnections 4000
    maxSSLConnections 3000
    keepAliveTimeout 7

  • MariaDB (/etc/mysql/my.cnf)

    innodb_buffer_pool_size = 5G
    innodb_log_file_size = 512M
    max_connections = 200

  • PHP (php.ini)

    memory_limit = 512M
    opcache.memory_consumption = 512
    opcache.max_accelerated_files = 30000

This balance ensures OLS handles requests smoothly, DB queries are mostly in RAM, and PHP code runs from OPcache instead of recompiled every hit.


Conclusion:

Yes, VPS spec ↔ DB buffer pool ↔ OPcache ↔ OLS worker settings are directly correlated.

  • Start from RAM split: ~60% DB, ~20% PHP OPcache, ~20% OLS workers + system.
  • Scale connections/workers to CPU count.
  • Never overshoot memory allocation — balance is key.

Why i never found recommendation to find tune ols evem if im using panel like cyberpanel, aapanel

Most control panel guides focus on installation and basic LSCache enablement. They rarely cover fine-tuning because the correct settings depend on workload and wrong advice can cause outages.

Here’s why you don’t see tuning recommendations even though OLS can be tuned heavily:


Panels abstract away OLS

  • Panels like CyberPanel and aaPanel are built for ease of use, not deep tuning.
  • They rely on OLS defaults, which are already quite optimized compared to Apache/Nginx.
  • Users see “it works fast out-of-the-box,” so devs don’t bother exposing worker/connection tuning.

For 80% of small/medium sites, defaults are “good enough” — only high-traffic cases benefit from fine-tuning.


OLS is event-driven (less need for manual tuning)

  • Apache/Nginx require explicit tuning of worker_processes, worker_connections, prefork/worker models.
  • OLS uses event-driven epoll by default → already efficient at handling thousands of concurrent connections.
  • That’s why tuning guides are rarer — OLS doesn’t “break” as easily under load with defaults.

So documentation is thinner compared to Nginx “worker” tuning guides.


Panels don't want users breaking things

  • If a user over-allocates PHP workers, maxConnections, or buffer pool, the server will crash (OOM).
  • Panels avoid recommending such changes to prevent support tickets.
  • Instead, they push you to “scale up VPS” rather than squeeze performance from tuning.

Safer for them, but it hides optimization power from advanced users.


OLS docs are developer-focused

  • LiteSpeed’s Enterprise edition (paid) gets full docs + enterprise tuning guides.
  • OLS (open source) is free, so docs are minimal — mainly install & LSCache plugin setup.
  • Advanced tuning knowledge is scattered in sysadmin forums, not official panel docs.

Database and PHP are usually the bottleneck

  • In most WordPress stacks, MariaDB (queries) or PHP execution (plugins/themes) are the slow points, not OLS.
  • That’s why tuning focus shifts to:
    • DB buffer pool size
    • OPcache
    • Redis/Memcached
    • LSCache rules
  • Panels assume: if DB and PHP are optimized, OLS can handle it with defaults.

So should you fine-tune OLS?

Yes — especially if you:

  • Run WooCommerce, LMS, or Membership sites (heavy PHP/MySQL).
  • Expect traffic spikes (campaigns, viral posts).
  • Want to handle more users per VPS (instead of paying for bigger VPS).

Then fine-tuning OLS workers, maxConnections, file descriptors, and PHP LSAPI makes a big difference.


In short:

You don’t see OLS tuning guides because:

  • Panels want simplicity + fewer breakages
  • OLS is efficient out of the box
  • Most bottlenecks come from PHP/DB, not OLS core
  • Advanced tuning is left to sysadmins (not average panel users)

If i fine tune ols estimate in percentage capabilities compare to entreprise ls

Excellent question. You’re asking: “If I fine-tune OpenLiteSpeed (OLS), how close can I get to LiteSpeed Enterprise (LSWS Enterprise) in capability/performance?”

Here’s the breakdown:


OLS vs LSWS Enterprise capabilities

Core engine

  • OLS and Enterprise LSWS share the same core event-driven engine.
  • Request handling, event dispatcher (epoll), caching logic → identical.
  • So base performance (raw RPS handling) is nearly the same.

Fine-tuned OLS can achieve ~90–95% of Enterprise performance for static + cached WordPress pages.


Caching

  • OLS: LSCache works, but some advanced cache features are disabled (e.g., ESI [Edge Side Includes], QUIC.cloud LQIP, WooCommerce cache “vary” controls).
  • Enterprise: Full LSCache feature set, deep integration with ESI blocks (per-user fragments in WooCommerce, logged-in pages).

For WooCommerce / LMS / Membership sites → Enterprise has 10–20% advantage because it handles logged-in user cache more efficiently.


Protocol support

  • Both: HTTP/2, HTTP/3 (QUIC), TLS 1.3, OCSP stapling.
  • Enterprise sometimes gets protocol optimizations faster, but performance difference is marginal (<5%).

Connection scaling

  • OLS: No formal support contracts, and some limits in ultra-high concurrency scenarios (10k+ concurrent).
  • Enterprise: Officially tested at 100k+ concurrent users with fine-tuned license.

For small/medium VPS (2–8 vCPU) → OLS performs same as Enterprise.

For very large sites (CDN origin, millions of hits/day) → Enterprise handles extreme concurrency better.


Support and stability

  • OLS: Community support only, some edge-case bugs linger longer.
  • Enterprise: Paid support, faster bug fixes, guaranteed updates.
  • For production at scale (e.g., SaaS, eCommerce >1M visitors/month) → Enterprise is safer.

Performance comparison (WordPress context)

Feature / ScenarioOLS (Fine-Tuned)Enterprise
Static cached pages (blog)~95%100%
WooCommerce shop w/ logged-in~80–85%100%
LMS / Membership site~80–85%100%
High-concurrency spikes (>10k)~85–90%100%
Security patches/supportCommunity onlySLA, Enterprise team
Resource efficiency (small VPS)~95%100%

Conclusion

  • If you fine-tune OLS properly (connections, LSAPI, OPcache, DB buffer pool), you can get 90–95% of Enterprise’s performance on normal WordPress sites.
  • For eCommerce, LMS, Membership (logged-in users) → OLS caps out at ~80–85% because ESI + advanced vary caching are missing.
  • For very high concurrency (tens of thousands concurrent) → Enterprise scales better with support.

In short:

  • Small/medium VPS & blog/corporate sites → OLS fine-tuned = Enterprise (no need to pay).
  • Large WooCommerce/LMS/membership at scale → Enterprise wins with +15–20% efficiency and advanced caching.

Practical note: for many WordPress sites (mostly anonymous traffic), a well-tuned OLS stack can reach Enterprise-level performance.

If your goal is to match (or exceed) Enterprise results with OLS, you typically compensate in three places:

  • hardware headroom (CPU/RAM/NVMe)
  • caching layers (Redis/object cache + CDN)
  • conservative concurrency limits (avoid LSAPI overload)

The next sections summarize where Enterprise wins and how to narrow the gap when using OLS.


Where Enterprise LSWS beats OLS

  • Edge Side Includes (ESI) → Fragment caching for WooCommerce/LMS logged-in users.
  • Advanced vary rules → More granular cache variation by cookie, device, user role.
  • Support & SLAs → Faster bug/security fixes.
  • Extreme concurrency (>50k concurrent) → Stress-tested at CDN/provider scale.

OLS doesn’t have those, so on logged-in eCommerce you’ll usually see ~15–20% lower throughput.


How to beat Enterprise LSWS using OLS

Overcompensate with hardware

  • If you run OLS on slightly better VPS specs than Enterprise, you can offset feature gaps.

  • Example:

    • LSWS Enterprise on 4 vCPU / 8 GB vs.

    • OLS fine-tuned on 6 vCPU / 12 GB

      OLS can match or exceed performance with proper tuning.

  • NVMe storage makes a big difference on WooCommerce DB workloads.


Redis and object cache (to replace ESI gap)

  • Since OLS doesn’t have full ESI, use Redis Object Cache Pro (or at least free Redis Object Cache).
  • Pair with LSCache plugin’s private cache (works in OLS).
  • This combination narrows the WooCommerce/membership performance gap.

Aggressive PHP and LSAPI tuning

  • Scale PHP workers = 2 × vCPU.

  • Enable OPcache 512M–1G depending on site size.

  • Reduce keepAliveTimeout to 5–7s to free connections faster.

  • Raise LimitNOFILE to 65535 to prevent bottlenecks.

    OLS tuned aggressively can serve 90–95% of Enterprise’s throughput.


MariaDB buffer pool priority

  • Allocate 50–70% of RAM to InnoDB buffer pool.
  • Example: On 16 GB VPS, give MariaDB 10 GB, PHP/OLS the rest.
  • This reduces DB disk I/O → faster WooCommerce queries → offsets lack of Enterprise cache tricks.

Use a CDN and tiered cache

  • With Cloudflare APO + Tiered Cache:
    • Even logged-in WooCommerce pages get edge acceleration.
    • This compensates for OLS missing ESI.
  • Enterprise advantage shrinks when CDN does the heavy lifting.

Micro-optimization layers

  • Brotli level 4–6 (better than gzip).
  • TLS 1.3 + HTTP/3 (QUIC enabled).
  • Cache static assets (css, js, fonts) at OLS + CDN.
  • Offload media to S3/Cloudflare R2.

These optimizations reduce the workload so OLS = Enterprise in practice.


Practical example

SetupPerformance
LSWS Enterprise, 4 vCPU / 8 GBBaseline 100%
OLS Fine-Tuned, 4 vCPU / 8 GB~85–90%
OLS Fine-Tuned, 6 vCPU / 12 GB~100–105%
OLS Fine-Tuned, 8 vCPU / 16 GB + Redis + CDN~110% (beats Enterprise on small VPS)

Conclusion

  • Can OLS beat LSWS?
    • On blogs/corporate/static + cached sites → Yes, easily with tuning + equal VPS.
    • On WooCommerce/LMS/membership → You’ll need slightly higher VPS spec + Redis + CDN to offset Enterprise’s ESI advantage.

In real terms:

  • Spend $10–20 more on VPS per month → OLS can beat Enterprise performance without paying Enterprise license ($36–$96/mo).
  • At scale, Enterprise is cheaper (license < cost of extra VPS). But for single-site VPS owners, OLS + tuning + beefier VPS is often the smarter play.

Why this great content never discuss on any blogger speed optimization

You’ve spotted a big gap in the “speed optimization” content market — and it’s one of those things that separates real sysadmin-level performance engineering from the usual “blogger speed hacks.”

Here’s why you almost never see deep OLS fine-tuning (workers, buffer pools, LSAPI, OPcache, sysctl, etc.) discussed on speed optimization blogs:


Audience mismatch

  • Most “speed optimization” blogs (WPBeginner, Kinsta blog, even WP Rocket’s content) target general WordPress users, not sysadmins.
  • Their readers want: “Install this plugin, enable page cache, compress images.”
  • If they published your kind of content (editing /usr/local/lsws/conf/httpd_config.conf, tuning innodb_buffer_pool_size), 90% of readers wouldn’t even know how to SSH.

It’s a business decision: write for the largest, non-technical audience → more pageviews & plugin sales.


Business incentives

  • Panels (CyberPanel, aaPanel, CloudPages) and hosts (LiteSpeed partners, cPanel resellers) don’t want users fiddling with low-level OLS.
  • Why? Because if you misconfigure OLS → you blame them.
  • They’d rather say “Upgrade your VPS” or “Buy LiteSpeed Enterprise license” than teach you how to squeeze 20–30% more performance for free.

They make money from upsells, not from you optimizing existing resources.


Complexity and risk

  • Real OLS fine-tuning requires:
    • Understanding event-driven I/O
    • Balancing CPU ↔ RAM ↔ DB pool ↔ PHP workers
    • Testing with wrk or ab under load
  • If a blogger gives wrong advice, readers might crash their server (OOM, 502 errors).
  • That risk is too high for a “casual blog post.”

So they stick with “safe advice” (plugins, CDN, image optimization).


Lack of expertise

  • Many speed optimization bloggers aren’t sysadmins — they’re content writers or agency folks.
  • They know how to use GTmetrix, PageSpeed Insights, and WP Rocket, but not how to tune LSAPI workers or file descriptors.
  • Real tuning knowledge lives in sysadmin forums, LiteSpeed docs, or performance engineers’ blogs — not mainstream WordPress sites.

SEO and affiliate focus

  • Blogger content is SEO-driven:
    • “Best cache plugins for WordPress” (affiliate links)
    • “How to speed up WordPress” (plugin checklists)
  • “How to tune epoll in OLS with LSAPI workers” has tiny search volume, so they won’t target it.

They’d rather chase 10,000 monthly searches for “best WordPress speed plugin.”


The real opportunity

  • This gap means YOU could own this space:
    • Teach VPS-level OLS tuning for WordPress.
    • Position it as premium optimization knowledge that normal blogs ignore.
    • Use real sysadmin + finance-style analysis (“performance per $ spent on VPS vs Enterprise license”).

That positions you as authority — not another “install this plugin” blog.


In short

You don’t see OLS fine-tuning on speed blogs because:

  1. Their audience is too non-technical.
  2. Hosts/panels want upsells, not optimizations.
  3. Risk of server crashes if wrong advice spreads.
  4. Bloggers often lack sysadmin-level knowledge.
  5. SEO + affiliate strategies reward plugin talk, not server tuning.

If you have root access on a VPS, you can fine-tune more than just the web server. Use this as a quick inventory of the layers you can tune in a full WordPress stack:

  • Web server (OLS)
  • Database (buffer pool and query behavior)
  • Object cache (Redis)
  • PHP runtime (OPcache)
  • CDN (Cloudflare)
  • LSCache plugin policy
  • Image pipeline (WebP/AVIF, compression, resizing)
  • Resource delivery (CSS/JS/HTML)

Complete VPS fine-tuning layers

Web server (OLS/LSWS) fine-tuning

  • Worker processes (maxConnections, maxSSLConnections, keepAliveTimeout)
  • Event dispatcher (epoll)
  • File descriptors (LimitNOFILE)
  • Brotli/gzip compression tuning
  • TLS 1.3 + HTTP/3, OCSP stapling

Database (MariaDB/MySQL) fine-tuning

  • InnoDB buffer pool size (50–70% of RAM)
  • InnoDB log file size (match workload, e.g., 512M)
  • Query cache → disabled in modern MariaDB
  • Temp tables in memory vs disk (tmp_table_size, max_heap_table_size)
  • Connection limits & thread pool

Object cache (Redis/Memcached)

  • Redis persistence tuning (AOF/RDB balance)
  • maxmemory-policy (e.g., allkeys-lru for WordPress)
  • Set dedicated Redis RAM (256M–1G depending on traffic)
  • Unix socket vs TCP (Unix socket faster on localhost)

PHP (lsphp) fine-tuning

  • OPcache memory (opcache.memory_consumption = 256–512M)
  • opcache.max_accelerated_files (20k–40k for WooCommerce)
  • LSAPI workers (lsapi_backend_children = 2 × vCPU)
  • PHP memory_limit (256M–512M)
  • PHP-FPM fallback (if not using LSAPI)

CDN (Cloudflare) fine-tuning

  • APO (Automatic Platform Optimization for WordPress)
  • Tiered cache + Argo (better cache hit ratio)
  • Polish (WebP/AVIF image optimization)
  • Rocket Loader OFF (can break JS, better to lazy-load manually)
  • Firewall rules (block bad bots, reduce load before VPS)

LSCache plugin fine-tuning

  • Enable cache varies (mobile, user role if needed)
  • Use ESI substitutes (if WooCommerce checkout/cart needs dynamic fragment cache)
  • Object cache integration (Redis)
  • Crawler (auto warm cache after expiry)
  • Exclude admin-ajax.php & wp-cron.php from caching

Image optimization fine-tuning

  • Pre-generate WebP/AVIF (ShortPixel, Imagify, or Cloudflare Polish)
  • Serve responsive images (srcset)
  • Lazy load only below-the-fold
  • Use CDN storage (Cloudflare R2, Bunny) for large libraries

Resource optimization fine-tuning

  • Merge/minify CSS/JS carefully (don’t break async)
  • Preload fonts, critical CSS
  • Defer non-critical JS
  • Serve fonts locally (Google Fonts self-hosted)
  • Reduce DOM depth (impact on CLS & rendering)

Additional layers you can tune (advanced)

Linux kernel and sysctl (networking and memory)

  • net.core.somaxconn = 65535
  • net.ipv4.tcp_tw_reuse = 1
  • vm.swappiness = 10
  • HugePages for MySQL

File system and I/O tuning

  • Use ext4 or xfs with noatime mount option
  • NVMe disks (huge boost for DB-heavy WordPress)
  • Tune innodb_flush_method = O_DIRECT for MariaDB

Cron and background jobs

  • Disable WP-cron → use system cron (crontab -e)
  • Offload heavy background tasks (emails, reports) to workers

Security and hardening (performance impact)

  • Fail2ban / CSF firewall (block abusive bots early)
  • Rate limiting in OLS for wp-login.php
  • WAF rules in Cloudflare to cut junk traffic

Final view: full stack to tune

  1. Web server (OLS/LSWS)
  2. Database (MariaDB/MySQL)
  3. Object cache (Redis/Memcached)
  4. PHP (LSAPI, OPcache)
  5. CDN (Cloudflare/others)
  6. LSCache (WordPress layer)
  7. Images (WebP/AVIF + lazy load)
  8. CSS/JS/HTML resources
  9. Linux kernel (sysctl, ulimit)
  10. File system (disk I/O tuning)
  11. Cron jobs (offload WP-cron)
  12. Security (performance-focused hardening)

Items 1-8 are application-layer tuning. Items 9-12 are system-layer tuning.

Kernel and I/O tuning are most important when you are hitting concurrency limits, disk saturation, or connection churn. The next sections explain what to tune and what symptoms those tunings address.


Linux kernel and sysctl tuning

These settings control how the kernel handles networking, memory, and connections.

Why it matters:

  • WordPress on OLS handles hundreds/thousands of concurrent connections.
  • Defaults in Ubuntu/Debian are conservative → safe, but not optimized for high concurrency.

Key Parameters:

sysctl settings (example)
net.core.somaxconn = 65535 # Max connection queue
net.ipv4.tcp_tw_reuse = 1 # Reuse closed sockets
net.ipv4.tcp_fin_timeout = 15 # Faster cleanup of dead sockets
vm.swappiness = 10 # Prefer RAM over swap
fs.file-max = 2097152 # Raise open files limit

Without this tuning, you may see:

  • 502/504 errors under traffic spikes
  • “Too many open files” in OLS logs
  • Latency from kernel holding onto sockets too long

Importance:

  • Small blog (2 vCPU / 4GB, <50 concurrent) -> Low impact
  • WooCommerce/membership (4–8 vCPU, 100–500 concurrent) → Medium impact
  • High-traffic site/CDN origin (1000+ concurrent) → Critical

File system and I/O tuning

This is about how the disk handles database and file reads/writes.

Why it matters:

  • WordPress = DB + PHP + static files.
  • On small VPS, disk I/O is often the hidden bottleneck (slow queries, slow media serving).
  • Database (MariaDB) constantly reads/writes from disk.

Key Optimizations:

  1. File system mount options

    • Use noatime → skip access time writes (faster).

    • Example /etc/fstab line:

      /dev/nvme0n1p1 / ext4 defaults,noatime 0 1

  2. Use NVMe instead of SATA

    • NVMe = 5–10x faster random I/O.
    • Huge for WooCommerce with many products/orders.
  3. MariaDB tuning

    • innodb_flush_method = O_DIRECT → bypass double caching
    • innodb_io_capacity = 2000 (for NVMe, vs 200 for HDD)

Without this tuning, you may see:

  • Slow checkout / cart queries
  • High disk I/O wait in htop
  • Spikes in response time even with caching

Importance:

  • Small blog (low DB writes) → Low impact
  • WooCommerce (heavy writes) → High impact
  • LMS / Membership (many logged-in users) → Critical

Summary

  • #9 (sysctl tuning) = About network & connection handling.
    • Important once you cross 100+ concurrent users or see 502/504 under load.
  • #10 (disk I/O tuning) = About database & file speed.
    • Important once you run WooCommerce, LMS, or membership where DB writes/reads are constant.

For a small blog on 2vCPU / 4GB, you can skip or keep defaults.

For WooCommerce or membership sites, both #9 and #10 are essential to unlock full VPS performance.


Next steps

  • Verify your active vhost, listener ports, and PHP handler are correct.
  • Enable caching intentionally (LSCache) and validate headers and bypass rules.
  • Add SSL and renewals (Certbot) and confirm OLS reloads after renewal.
CLI quick checks
openlitespeed-quick-checks.sh
systemctl status lsws
sudo tail -n 200 /usr/local/lsws/logs/error.log
sudo ss -lntup | rg -n '(:80|:443|:7080|:8088)'