Skip to main content

Process Limits

Learning Focus

By the end of this lesson you will know how to set PHP process limits to balance concurrency against available resources.

What Process Limits Control

Process limits determine how many PHP workers run simultaneously to handle requests. This is set in the external application configuration via Max Connections.

Impact of Wrong Sizing

SettingToo LowToo High
Max ConnectionsRequests queue, slow responsesMemory exhaustion, swapping, crashes

Sizing Approach

  1. Calculate available RAM after OS, OpenLiteSpeed, and database
  2. Divide by per-worker memory usage (from ps monitoring)
  3. Set Max Connections to that number minus a safety margin
# Check per-worker memory usage
ps aux | grep lsphp | awk '{print $6/1024 " MB"}'

# Count current workers
ps aux | grep lsphp | grep -v grep | wc -l
Server RAMAvailable for PHPWorker memoryMax Workers
1 GB~600 MB80 MB7
2 GB~1.2 GB80 MB15
4 GB~2.5 GB100 MB25
8 GB~5 GB100 MB50

Configuring in WebAdmin

  1. Server ConfigurationExternal App → select your lsphp app
  2. Set Max Connections to your calculated value
  3. Save and Graceful Restart
info

Monitor PHP worker usage under real traffic patterns. Adjust based on actual measurements rather than theoretical calculations.

Key Takeaways

  • Right-size PHP workers from available RAM and measured per-worker memory, not guesswork.
  • Too few workers increase queueing; too many workers cause swap pressure.
  • Monitor and adjust under real traffic patterns.

What's Next