php / php/php-src

Include the configured max_children in the fpm status page

Aperta
#16,221 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Feature SAPI: fpm
Lingua principale
C
Stelle
40.4k
Fork
8.1k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

Description

Hello,

We want to use the FPM Status Page to monitor for PHP worker exhaustion. We use the process manager ondemand, and we have noticed that we are lacking the data that shows how many children could potentially be created (the max_children directive).

The FPM status looks like this:

{
  "pool": "moodletes_89",
  "process manager": "ondemand",
  "start time": 1727966418,
  "start since": 119,
  "accepted conn": 18,
  "listen queue": 0,
  "max listen queue": 0,
  "listen queue len": 0,
  "idle processes": 1,
  "active processes": 0,
  "total processes": 1,
  "max active processes": 5,
  "max children reached": 0,
  "slow requests": 0,
  "processes": [
    {
      "pid": 2118218,
      "state": "Idle",
      "start time": 1727966430,
      "start since": 107,
      "requests": 9,
      "request duration": 129,
      "request method": "GET",
      "request uri": "opcache.php",
      "content length": 0,
      "user": "-",
      "script": "/usr/local/src/opcache.php",
      "last request cpu": 0,
      "last request memory": 2097152
    }
  ]
}

Here we do have max active processes, which shows the amount of processes that have been active at any point. This eventually grows to the max_children on a busy site, but after a restart it resets.
We also have idle_processes, but since we use ondemand as the process manager, we can not use this value for determing how much headroom there is, as more processes are spawned automatically (until max_children is reached).

Would it be possible to expose the max_children directive, so we can determine when all workers are busy and no more workers can be created?

As a sidenote, we originally tried to achieve this by monitoring the listen queue > 0, however it seems this value does not work when FPM is configured with a unix-socket, and only works on TCP/IP sockets. Due to this we cannot use this method either.

Thank you!

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia tracciando la generazione della pagina di stato di FPM e il punto in cui viene letta la direttiva max_children configurata. Aggiungi il valore all'output dello stato e verifica che la pagina lo esponga per il gestore dei processi ondemand.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
c, php
Ambito
backend, observability
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.