Performance Optimization
OpenLiteSpeed is already fast by design, but strong performance comes from tuning the right layers in the right order.
Caching
LiteSpeed Cache Engine
LiteSpeed Cache can serve cached responses without invoking PHP for every request. This is especially valuable for CMS workloads such as WordPress.
Browser Cache
Use cache-control and expiry headers for CSS, JavaScript, images, and fonts so browsers reuse assets instead of redownloading them.
Object Cache
OpenLiteSpeed itself does not replace Redis or Memcached object caching. Pair LiteSpeed Cache with application-level object caching for dynamic workloads.
Cache Rules
Design rules carefully:
- Cache anonymous pages aggressively
- Exclude carts, checkouts, and user dashboards
- Vary cache by device or cookies only when necessary
- Purge on content updates instead of using short TTLs everywhere
Compression
Gzip Compression
Gzip is widely compatible and should be enabled for text-based assets such as HTML, CSS, JavaScript, JSON, and XML.
Brotli Compression
Brotli usually provides better compression ratios than gzip for modern browsers. It is ideal for static assets where CPU cost is amortized.
Static File Optimization
Static File Handling
Serve static assets directly from OpenLiteSpeed whenever possible. Avoid routing images, stylesheets, or downloads through PHP if not required.
File Cache
The server can keep frequently accessed file metadata and content hot, reducing repeated disk lookups on busy sites.
Sendfile Optimization
sendfile allows the kernel to transfer files more efficiently for large static downloads, though it should be validated with your filesystem and container environment.
Connection Optimization
Keep-Alive
Keep-alive reduces handshake overhead by reusing connections for multiple assets. Set timeouts high enough to help browsers, but not so high that idle clients waste capacity.
HTTP/2
HTTP/2 improves multiplexing and header compression for HTTPS traffic and is a strong default for most sites.
HTTP/3 (QUIC)
HTTP/3 uses QUIC over UDP and can reduce latency on lossy networks. Enable it only after confirming firewall and upstream network support.
Tuning Priorities
| Priority | Why It Matters |
|---|---|
| Cache correctly | Largest gain for dynamic sites |
| Serve static files directly | Removes PHP overhead |
| Enable compression | Reduces transfer size |
| Use HTTP/2 or HTTP/3 | Improves client delivery efficiency |
| Tune keep-alive | Balances responsiveness and concurrency |
Common Mistakes
- Caching logged-in or personalized pages unintentionally
- Enabling compression for already compressed formats like JPEG or MP4
- Sending static assets through PHP handlers
- Turning on HTTP/3 without opening the required UDP path
- Optimizing server settings before measuring application bottlenecks