PHP-FPM pm.min_spare_servers Explained: Configuration, Idle Workers, and Best Practices

Published: 2026-07-12

Introduction

The pm.min_spare_servers directive specifies the minimum number of idle worker processes that PHP-FPM should maintain when using the dynamic process manager.

Idle workers are ready to accept new requests immediately. If the number of idle workers falls below the configured minimum, PHP-FPM automatically creates additional workers until the minimum level is restored.

Properly configuring this setting helps reduce response latency during traffic spikes while avoiding unnecessary resource consumption.

This guide explains how pm.min_spare_servers works, how it interacts with other PHP-FPM directives, recommended values, and common configuration mistakes.

Test Environment

Operating System : AlmaLinux 10
PHP Version      : PHP 8.3
Web Server       : Nginx
PHP-FPM          : Enabled
Architecture     : x86_64
Last Tested      : July 2026

What Is pm.min_spare_servers?

When PHP-FPM runs in dynamic mode, some worker processes remain idle while waiting for new requests.

The pm.min_spare_servers directive defines the minimum number of idle workers PHP-FPM should keep available.

Example:

pm = dynamic

pm.min_spare_servers = 5

In this example, PHP-FPM always tries to keep at least five idle workers available.

How It Works

Assume the following configuration:

pm = dynamic

pm.min_spare_servers = 5

Initially:

PHP-FPM Pool

Worker 1  Idle
Worker 2  Idle
Worker 3  Idle
Worker 4  Idle
Worker 5  Idle

Traffic increases:

Worker 1  Busy
Worker 2  Busy
Worker 3  Busy
Worker 4  Busy
Worker 5  Idle

More requests arrive:

Worker 1  Busy
Worker 2  Busy
Worker 3  Busy
Worker 4  Busy
Worker 5  Busy

At this point, there are zero idle workers, which is below the configured minimum.

PHP-FPM automatically creates additional workers:

Worker 6  Idle
Worker 7  Idle
Worker 8  Idle
Worker 9  Idle
Worker 10 Idle

The idle worker count is restored without requiring a service restart.

Check the Current Value

Most Linux distributions store pool settings in:

/etc/php-fpm.d/www.conf

Run:

grep pm.min_spare_servers /etc/php-fpm.d/www.conf

Example:

pm.min_spare_servers = 5

Change pm.min_spare_servers

Open the PHP-FPM pool configuration.

sudo nano /etc/php-fpm.d/www.conf

Locate:

pm.min_spare_servers = 5

Example:

pm.min_spare_servers = 10

Save the file.

Restart PHP-FPM

Apply the changes.

sudo systemctl restart php-fpm

Verify:

sudo systemctl status php-fpm

Expected output:

Active: active (running)

Relationship with Other PHP-FPM Settings

pm.min_spare_servers works together with several other process manager directives.

PHP-FPM Pool
      │
      ├── pm = dynamic
      ├── pm.start_servers
      ├── pm.min_spare_servers
      ├── pm.max_spare_servers
      └── pm.max_children

Each setting has a different responsibility.

| Directive              | Purpose                                  |
| ---------------------- | ---------------------------------------- |
| `pm.start_servers`     | Number of workers created during startup |
| `pm.min_spare_servers` | Minimum number of idle workers           |
| `pm.max_spare_servers` | Maximum number of idle workers           |
| `pm.max_children`      | Maximum number of worker processes       |

Example Configuration

pm = dynamic

pm.start_servers = 8

pm.min_spare_servers = 4

pm.max_spare_servers = 12

pm.max_children = 40

Behavior:

PHP-FPM starts with 8 workers.

If idle workers fall below 4, new workers are created.

If idle workers exceed 12, extra idle workers are terminated.

The total number of workers never exceeds 40.

Recommended Values

| Server Type              | Suggested Value |
| ------------------------ | --------------- |
| Personal website         |             2–4 |
| Small business           |             3–6 |
| WordPress                |            5–10 |
| Laravel                  |            5–10 |
| High-traffic application |           10–20 |

These values should always be adjusted according to available memory and expected traffic.

Common Issues

Too Few Idle Workers

Example:

pm.min_spare_servers = 1

When traffic suddenly increases, PHP-FPM must create new workers before processing all requests.

This may slightly increase response time during traffic spikes.

Too Many Idle Workers

Example:

pm.min_spare_servers = 30

If traffic is low, many workers remain idle while still consuming memory.

This reduces the amount of RAM available for other services such as MySQL, Redis, or the operating system.

Configuration Error

A common mistake is configuring:

pm.start_servers = 3

pm.min_spare_servers = 8

This is inconsistent because PHP-FPM starts with fewer workers than the configured minimum idle requirement.

A more reasonable configuration would be:

pm.start_servers = 8

pm.min_spare_servers = 5

pm.max_spare_servers = 10

The startup value should generally fall between the minimum and maximum idle worker limits.

Best Practices

Use pm.min_spare_servers only when pm = dynamic.

Configure enough idle workers to handle normal traffic without excessive process creation.

Avoid reserving large numbers of idle workers on low-memory servers.

Keep pm.start_servers, pm.min_spare_servers, and pm.max_spare_servers logically consistent.

Monitor worker activity and memory usage before making significant adjustments.

Conclusion

The pm.min_spare_servers directive controls the minimum number of idle PHP-FPM worker processes maintained in dynamic mode. By ensuring that idle workers are always available, PHP-FPM can respond more quickly to incoming requests while automatically scaling the worker pool as demand changes.

Rather than tuning this directive in isolation, it should be configured together with pm.start_servers, pm.max_spare_servers, and pm.max_children to achieve a balanced combination of performance, responsiveness, and efficient memory usage.

Explore More

Technology Guides →

PHP-FPM pm.max_spare_servers Explained: Configuration, Idle Worker Limits, and Best Practices

PHP-FPM pm.max_children Explained: Configuration, Performance, and Best Practices

PHP-FPM pm.max_requests Explained: Configuration, Memory Management, and Best Practices

PHP-FPM pm.start_servers Explained: Configuration, Worker Management, and Best Practices

Southeast Asia Insights →

Best Coworking Spaces in Bangkok 2026: A Guide for Digital Nomads and Remote Workers

Best Areas to Live in Bangkok in 2026: A Complete Guide for Expats and Digital Nomads

Why Do People in Southeast Asia Love Iced Drinks? The Climate, Culture, and Science Explained

Best eSIM for Southeast Asia in 2026: Compare the Top Travel eSIMs