php / php/php-src

Include the configured max_children in the fpm status page

Offen
#16,221 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Feature SAPI: fpm
Vorherrschende Sprache
C
Sterne
40.4k
Forks
8.1k
Ø Merge
2 T. 13 Std.
Gemergte PRs (30 T.)
96

Beschreibung

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!

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, die Generierung der FPM-Statusseite und die Stelle nachzuverfolgen, an der die konfigurierte max_children-Direktive gelesen wird. Füge den Wert der Statusausgabe hinzu und überprüfe, dass die Seite ihn für den ondemand-Prozessmanager offenlegt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, php
Bereich
backend, observability
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.