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
| Setting | Too Low | Too High |
|---|---|---|
| Max Connections | Requests queue, slow responses | Memory exhaustion, swapping, crashes |
Sizing Approach
- Calculate available RAM after OS, OpenLiteSpeed, and database
- Divide by per-worker memory usage (from
psmonitoring) - 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 RAM | Available for PHP | Worker memory | Max Workers |
|---|---|---|---|
| 1 GB | ~600 MB | 80 MB | 7 |
| 2 GB | ~1.2 GB | 80 MB | 15 |
| 4 GB | ~2.5 GB | 100 MB | 25 |
| 8 GB | ~5 GB | 100 MB | 50 |
Configuring in WebAdmin
- Server Configuration → External App → select your lsphp app
- Set Max Connections to your calculated value
- 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
- Return to the PHP Integration module for the complete overview.