[ZBX-22582] PHP-fpm processes high cpu utilization Created: 2023 Mar 24  Updated: 2023 Aug 29

Status: Open
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 6.2.8
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Grigoriy Efremov Assignee: Aigars Kadikis
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Ubuntu 22.04.2 LTS
Kernel: Linux 5.15.0-60-generic
Architecture: x86-64
Zabbix 6.2.8
PHP 8.2.4
PostgreSQL 15.2 (Ubuntu 15.2-1.pgdg22.04+1)
Timescaledb 2.10.0


Attachments: File 6.2.9.index.php     File 6.2.9.zabbix.php     PNG File Screenshot_1.png     Text File ZBX-22582.patch     Zip Archive ZBX-22582.patch.and.files.zip     File autoload.php     PNG File image-2023-03-24-12-30-37-220.png     PNG File image-2023-03-27-16-17-22-252.png     PNG File image-2023-03-27-16-17-46-179.png     PNG File image-2023-04-18-09-44-20-660.png     PNG File image-2023-04-18-09-44-22-916.png     File index.php     PNG File scr2.png     PNG File screenshot-1.png     Text File strace.log     File zabbix.php    
Issue Links:
Sub-task

 Description   

Steps to reproduce:

  1. Promlem starts after update from php-fpm 7.4 to 8.1, and increases after update to 8.2

Result:
I am attaching the php process "strase", errors are visible in it
See log file.



 Comments   
Comment by Aigars Kadikis [ 2023 Mar 27 ]

I see you are using almost the most recent software in any category. Thank you for testing out these components.

The patchs mentioned in strace.log are not standard paths of Zabbix frontend files.

1) Do you use stock Zabbix packages on Ubuntu 22?

apt list --installed | grep zabbix

2) Does Zabbix frontend is exposed to internet? If yes, could you try to reconfigure the web server port to listen on a different port (not use 80/443)? See if the CPU usage goes away.

Comment by Grigoriy Efremov [ 2023 Mar 27 ]

1) yes I'm using packages from official repo:  https://repo.zabbix.com/zabbix/6.2/ubuntu jammy main

2) уes, frontend is exposed to internet. I can't reconfigure the web server port to listen on a different port, we use several services like grafana to integrate zabbix through api

Comment by Aigars Kadikis [ 2023 Apr 17 ]

ZBX-22582.patch.and.files.zip
Please patch your frontend files.

BTW, this is an interesting findings which can lower down CPU usage for different Zabbix builds. We will wait for your feedback.

Patch is only applicable for 6.2.x. "autoload.php" is a new file and must be placed in the /usr/share/zabbix

Comment by Grigoriy Efremov [ 2023 Apr 18 ]

I've placed file "autoload.php" in /usr/share/zabbix. There is the same file in /usr/share/zabbix/vendor/, should I replace it?
I've also increased number of cores to 6 and still have problem with error like "(No such file or directory)" in strace output

Comment by Gregory Chalenko [ 2023 Apr 18 ]

efremovgv you do not need to replace vendor/autoload.php file, just place new one in same directory where zabbix.php file is. Also please apply the patch otherwise autoloader will not start. When applied there will be much less "No such file or directory", error still be present because local directory files also as modules directory files cannot be added to autoloader.php.

Comment by Grigoriy Efremov [ 2023 Apr 18 ]

Also please apply the patch otherwise autoloader will not start what does it mean? I've just unzip ZBX-22582.patch.and.files.zip to /usr/share/zabbix and restart nginx and php-fpm

Comment by Gregory Chalenko [ 2023 Apr 18 ]

Go to /usr/share/zabbix directory, unzip and then execute git apply ZBX-22582.txt to apply changes to zabbix.php and index.php files.

Comment by Alexander Plotnikov [ 2023 Apr 18 ]

When trying to apply the patch, the following error occurs. Is it necessary to change the path inside ZBX-22582.txt ?

Comment by Gregory Chalenko [ 2023 Apr 18 ]

Sorry patch was created as for Zabbix installed from git repository. Attached correct ZBX-22582.patch file, to apply go to /usr/share/zabbix directory and execute: patch < ZBX-22582.patch.

Comment by Alexander Plotnikov [ 2023 May 11 ]

Is there such a patch for version 6.4.*? After upgrading from 6.2.9 to 6.4.2, the problem with user time cpu and total load returned

Comment by Aigars Kadikis [ 2023 May 22 ]

Hello Glafkon ,

Please download index.phpand zabbix.phpand overwrite to:

/usr/share/zabbix/zabbix.php
/usr/share/zabbix/index.php

This is tested and suitable for Zabbix 6.4.2. Let us know if CPU loading issue goes away.

Comment by Aigars Kadikis [ 2023 May 22 ]

Hello efremovgv , please download 6.2.9.index.phpand 6.2.9.zabbix.php and install the files on:

/usr/share/zabbix/zabbix.php
/usr/share/zabbix/index.php

This is suitable for Zabbix 6.2.9. Let us know if it solves CPU problem.

Comment by Grigoriy Efremov [ 2023 May 22 ]

Thanks, I've alrady update on 6.4.2. I'll try files for 6.4.*

Comment by Aigars Kadikis [ 2023 Jun 20 ]

Hello Glafkonefremovgv . Would you mind trying to patch and report back CPU usage?

Comment by Grigoriy Efremov [ 2023 Jun 20 ]

CPU usage is fine, thanks for the patch

Comment by Aigars Kadikis [ 2023 Jun 20 ]

I did miss an important statement. Appart from:

/usr/share/zabbix/zabbix.php
/usr/share/zabbix/index.php

There also must be autoload.php placed:

/usr/share/zabbix/autoload.php

This will do the optimal loading. Take a screenshot of CPU usage. Then install this file. Have a look of CPU usage again for "php-fpm" process.

Comment by Alexander Plotnikov [ 2023 Jun 20 ]

Aigars Kadikis Hello. This version autoload.php (which you attached) file compatibility with Zabbix 6.4.3 version?

Comment by Gregory Chalenko [ 2023 Jun 22 ]

Yes it is compatible with version 6.4.3

Comment by Alexander Plotnikov [ 2023 Aug 28 ]

Unfortunately, the problem persists. When opening 6-8 graphs (in different browser tabs) in 1 day (last 1 day), the load on the CPU increases dramatically.
Zabbix version 6.4.5. Ubuntu 22.04.3 LTS. PHP-FPM 8.2. PostgreSQL 15.

UPD.
Slightly reduced the number of graphs in the Templates. Reduced the value of "Max number of columns and rows in overview tables" and "Max count of elements to show inside table cell" from 50 to 30

Generated at Fri May 09 08:15:22 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.