You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHP-FPM uses a process manager to handle incoming requests efficiently. The configuration directly affects what you see
183
-
in system monitoring tools like `htop`.
193
+
**FPM Calculator Tool:**
194
+
195
+
Use the interactive calculator at https://spot13.com/pmcalculator/ to determine optimal settings:
196
+
197
+

184
198
185
-
**Key Configuration Settings:**
199
+
### Key Configuration Settings
200
+
201
+
PHP-FPM uses a process manager to handle incoming requests efficiently. The configuration directly affects what you see in system monitoring tools like `htop`.
186
202
187
203
```ini
188
-
pm = dynamic
189
-
pm.max_children = 50
190
-
pm.start_servers = 5
191
-
pm.min_spare_servers = 5
192
-
pm.max_spare_servers = 35
204
+
pm = dynamic # Process manager type (static, dynamic, ondemand)
205
+
pm.max_children = 50 # Maximum number of child processes
206
+
pm.start_servers = 5 # Number of children created on startup
207
+
pm.min_spare_servers = 5 # Minimum idle processes
208
+
pm.max_spare_servers = 35 # Maximum idle processes
209
+
pm.max_requests = 500 # Requests before process restart (helps with memory leaks)
193
210
```
194
211
195
-
**Important:**`pm.start_servers = 5` means you will see **5 child processes** in `htop` when the container starts, plus
196
-
1 master process (total 6 PHP-FPM processes).
212
+
**Process Manager Types:**
213
+
-`static` - Fixed number of processes (best for consistent load)
214
+
-`dynamic` - Scales between min/max spare servers (good for variable load)
215
+
-`ondemand` - Creates processes on demand (best for low/intermittent traffic)
216
+
217
+
**Important:**`pm.start_servers = 5` means you will see **5 child processes** in `htop` when the container starts, plus 1 master process (total 6 PHP-FPM processes).
197
218
198
-
### Process Hierarchy in htop
219
+
### Process Hierarchy and Behavior
199
220
200
221
When you run `htop` or `ps aux | grep php-fpm`, you'll see:
201
222
202
223
```
203
-
1 × php-fpm: master process
204
-
5 × php-fpm: pool www (child processes)
224
+
1 × php-fpm: master process (manages child processes)
225
+
5 × php-fpm: pool www (child processes handling requests)
0 commit comments