Nc18 php-fpm cpu is too high please help me

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 18.0.2): 18.0.2
Operating system and version (eg, Ubuntu 20.04):centos7.4
Apache or nginx version (eg, Apache 2.4.25): 1.14.2
PHP version (eg, 7.1):7.3

The issue you are facing:
when use jmeter login to /apps/files only 15 concurrent.THE php-fpm CPU is too high.
my server is esxi virtual machine.WEB SERVER: 8cpu 32GB memory.MYSQL SERVER 8cpu 32GB memory.
This is use jmeter


This is one user WEB login.success login about 1.5s. Refresh other url is the same problem.


Is this the first time you’ve seen this error? (Y/N):yes

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:

![image|690x293](upload://sEm36TgzNxOGCJk9t6ZWMNTJoc8.png) 

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array ( 
  'instanceid' => 'xxxxx',
  'passwordsalt' => 'xxxx',
  'secret' => 'xxxx',
  'trusted_domains' =>
  array (
    0 => 'xxxx.cn',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '18.0.2.2',
  'overwrite.cli.url' => 'https://xxxxx.cn',
  'dbname' => 'nextcloud',
  'dbhost' => '192.168.106.215',
  'dbport' => '3306',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxxx',
  'installed' => true,
  'default_language' => 'zh_CN',
  'default_locale' => 'zh_CN',
  'logtimezone' => 'Asia/Shanghai',
  'tempdirectory' => '/var/big_temp_file/',
  'lost_password_link' => 'https://xxxxxx.com',
  'remember_login_cookie_lifetime' => 86400,
  'session_lifetime' => 86400,
  'session_keepalive' => true,
  'skeletondirectory' => '',
  'has_internet_connection' => false,
  'logfile' => '/data/log/nextcloud.log',
  'log.condition' =>
  array (
    'apps' =>
    array (
      0 => 'admin_audit',
    ),
  ),
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '127.0.0.1',
    'port' => 6379,
    'timeout' => 0.0,
  ),
);

The output of your Apache/nginx/system log in /var/log/____:

nginx log is all OK.

sorry.
when use jmeter login to /apps/files only 100 concurrent.THE 15 concurrent is about 60% CPU.

Perhaps 11% of cpu is not too much. Perhaps it is the number of processes on each cpu.

Is it possible to configure it? Test some settings. Please post your settings.

hey man.this is my php www.conf
pm = static
pm.max_children = 100
pm.start_servers = 16
pm.min_spare_servers = 12
pm.max_spare_servers = 36
pm.max_requests = 500

my server is 8xcpu 32GB memory…memory is OK.but CPU very high.

Ok. One process uses e.g. 10% . For 50% you can use 5 children and for 8 cpus 5 * 8 = 40 children. Perhaps you can set

pm.max_children = 50

Test the cpu with “top” again and look netcloud (jmeter) works well or not.
Can you post the number of php-fpm-processes in different tests?

i set pm.max_children = 50. CPU is 90%.same problem.
when i use my Chrome to login nc the CPU also high.
your nc is not this problem??

Did you check that Redis and APCu are online? Not seen via your screenshot. https://docs.nextcloud.com/server/18/admin_manual/configuration_server/caching_configuration.html?highlight=cache#id1

yes.this is my config.php
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcache.distributed’ => ‘\OC\Memcache\Redis’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ =>
array (
‘host’ => ‘127.0.0.1’,
‘port’ => 6379,
‘timeout’ => 0.0,
),

and use php73 -m include apcu 、redis

1 Like

this is my php all config
/etc/php-fpm.d/www.conf
user = www
group = www
listen = 127.0.0.1:9000
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

mkdir -p /var/lib/php/session
chown www:www -R /var/lib/php/session/
/etc/php.ini
session.save_handler = “files”
session.save_path = “/var/lib/php/session/”
vim /etc/php-fpm.d/www.conf
php_value[session.save_handler] = “files”
php_value[session.save_path] = “/var/lib/php/session/”

/etc/php.d/opcache.ini
zend_extension=opcache.so
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=1
opcache.save_comments=1

/etc/php.d/apcu.ini
apc.enable_cli=1

/etc/php.ini
php_value upload_max_filesize 16G
php_value post_max_size 16G
php_value max_input_time 3600
php_value max_execution_time 3600
max_file_uploads = 100 #(上传文件数量)

/etc/php.ini
memory_limit = 1024M
vim /etc/php-fpm.d/www.conf
php_admin_value[memory_limit] = 1024M

/etc/php.ini
output_buffering = 0

vim /etc/php.ini
error_log = /data/log/php_error.log
vim /etc/php-fpm.conf
error_log = /data/log/php-fpm_error.log
vim /etc/php-fpm.d/www.conf
access.log = /data/log/php_access.log
slowlog = /data/log/php_www_slow.log
php_admin_value[error_log] = /data/log/php-fpm_www_error.log