Skip to main content

Process Management

Learning Focus

By the end of this lesson you will understand how OpenLiteSpeed spawns and manages PHP workers, what limits to configure, and how to right-size worker pools.

How PHP Worker Management Works

OpenLiteSpeed manages lsphp workers through the external application definition. It controls how many workers to spawn, when to create new ones, and when to recycle idle workers.

Key Settings

SettingWhat It ControlsRecommended Range
Max ConnectionsMaximum concurrent PHP requests10-50 depending on RAM
Initial Request TimeoutTime to wait for first response60s
Retry TimeoutDelay before retrying a failed connection0
Persistent ConnectionKeep lsphp connections aliveYes
Response BufferingBuffer PHP outputYes

Sizing PHP Workers

The formula: Workers × memory_limit ≤ Available RAM

Server RAMPHP memory_limitMax Workers
1 GB128 MB6-8
2 GB128 MB12-15
4 GB256 MB12-16
8 GB256 MB25-30
# Check current PHP worker count
ps aux | grep lsphp | grep -v grep | wc -l

# Check memory per worker
ps aux | grep lsphp | awk '{print $6/1024 " MB"}'
warning

Too many PHP workers cause swap pressure and worse performance. Too few workers increase request queueing. Always size from actual memory usage.

Key Takeaways

  • PHP worker count should be based on available RAM and memory_limit, not guesswork.
  • Monitor worker counts and memory usage under real traffic.
  • Use persistent connections to reduce worker creation overhead.

What's Next