Skip to content

ADR-004: PHP-FPM dynamic Instead of ondemand for Fediverse Pools

Status

Accepted

Context

The Friendica/OpenSocial fediverse PHP-FPM pools handle bursty, unpredictable ActivityPub federation traffic.

ondemand was initially deployed but caused monitoring issues: it shows ~100% active/total workers by design (no idle workers). This triggered PHPFPMApproachingMaxCapacity Prometheus alerts continuously, making the alert useless for detecting actual capacity problems.

Decision

Use dynamic process management for all fediverse PHP-FPM pools:

  • pm = dynamic
  • pm.min_spare_servers = 5
  • pm.max_spare_servers = 20
  • pm.max_children = 40-50

Consequences

  • PHPFPMApproachingMaxCapacity alerts fire only when the pool is genuinely running out of workers
  • ✅ Better burst absorption — idle workers are pre-forked and ready immediately
  • ✅ Monitoring dashboards show meaningful utilization percentages
  • ⚠️ Higher baseline memory (~5-20 idle workers × ~20-50 MiB each = 100-1000 MiB reserved)
  • ⚠️ Workers stay alive during low-traffic periods (acceptable given 8-10G container limits)
  • 🔗 See: services/friendica-opensocial.md for FPM pool configuration details