php / php/php-src

Include the configured max_children in the fpm status page

Đang mở
#16,221 2 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Feature SAPI: fpm
Ngôn ngữ chính
C
Star
40.4k
Fork
8.1k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
96

Mô tả

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!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách truy vết quá trình tạo trang trạng thái FPM và nơi đọc chỉ thị max_children đã cấu hình. Thêm giá trị này vào đầu ra trạng thái và xác minh rằng trang hiển thị giá trị đó cho trình quản lý tiến trình ondemand.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
c, php
Lĩnh vực
backend, observability
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.