Inigo Montoya

Registered
May 16, 2018
3
0
1
USA
cPanel Access Level
Root Administrator
Is there a list of information I should gather from my server that would be helpful in diagnosing the performance issues? I would like to get all of the information once to avoid misdiagnosis and further problems.

Thank you!
 

Inigo Montoya

Registered
May 16, 2018
3
0
1
USA
cPanel Access Level
Root Administrator
I'm experiencing long delays in servicing requests. I am running vBulletin 4.2.5 on PHP 5.6 (I've also tried 7.0). When there is a few users the server is responsive, but that quickly deteriorates.

My server is an 8 core, 4GB ram VPS:
Code:
[[email protected] tool]# grep '' /etc/redhat-release /usr/local/cpanel/version /var/cpanel/envtype ; grep CPANEL= /etc/cpupdate.conf
/etc/redhat-release:CentOS Linux release 7.5.1804 (Core)
/usr/local/cpanel/version:11.70.0.41
/var/cpanel/envtype:kvm
CPANEL=release
Running top on the server shows:
Code:
top - 17:14:18 up 6 days, 20:29,  1 user,  load average: 10.40, 11.44, 10.99
Tasks: 196 total,   6 running, 190 sleeping,   0 stopped,   0 zombie
%Cpu(s): 37.1 us,  6.1 sy,  0.0 ni,  3.1 id,  0.0 wa,  0.0 hi,  0.3 si, 53.3 st
KiB Mem :  3880660 total,   197980 free,  2084664 used,  1598016 buff/cache
KiB Swap:  4063228 total,  3919612 free,   143616 used.  1269804 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
12928 mysql     20   0 2686596 534972  12412 S  37.4 13.8   5:07.18 mysqld
12636 oh2admin  20   0  753724  47592  19916 S  15.2  1.2   1:03.54 php-fpm
12630 oh2admin  20   0  758824  50812  18596 S  12.9  1.3   1:01.06 php-fpm
12632 oh2admin  20   0  755560  50760  21208 S  12.3  1.3   1:01.38 php-fpm
12638 oh2admin  20   0  754412  47504  19548 R  11.9  1.2   1:07.21 php-fpm
12639 oh2admin  20   0  831960  54636  22800 R  11.9  1.4   1:03.61 php-fpm
12629 oh2admin  20   0  754332  49040  20876 S  10.0  1.3   1:03.68 php-fpm
12646 oh2admin  20   0  752312  47316  21044 S   9.7  1.2   1:03.78 php-fpm
12628 oh2admin  20   0  754688  47444  18936 S   9.4  1.2   1:06.10 php-fpm
12641 oh2admin  20   0  754228  48264  20080 S   8.4  1.2   1:04.22 php-fpm
12637 oh2admin  20   0  755856  48952  19124 S   6.8  1.3   1:02.20 php-fpm
12648 oh2admin  20   0  754216  47508  19480 R   6.5  1.2   1:03.95 php-fpm
12631 oh2admin  20   0  753928  48720  21028 S   5.8  1.3   1:02.61 php-fpm
12635 oh2admin  20   0  754728  50080  21388 S   5.8  1.3   1:04.54 php-fpm
12640 oh2admin  20   0  756348  50300  20384 S   4.8  1.3   1:05.39 php-fpm
12649 oh2admin  20   0  754336  48232  19944 R   4.2  1.2   1:04.71 php-fpm
31111 nginx     20   0  186432  55272   5212 S   4.2  1.4   5:08.72 nginx
I'm running apache, php-fpm, nginx, and mariadb as the database server. My php.conf is:
Code:
# This file was automatically generated by the Cpanel php
# Configuration system.  If you wish to change the way php is being
# handled by Apache on your system, use the
# /usr/local/cpanel/bin/rebuild_phpconf script or the WHM interface.
#
# Manual edits of this file will be lost when the configuration is
# rebuilt.

# CGI configuration for ea-php56
<IfModule actions_module>
  Action application/x-httpd-ea-php56 /cgi-sys/ea-php56
</IfModule>

# suPHP configuration for ea-php70
<IfModule suphp_module>
  suPHP_Engine on
  <Directory />
    suPHP_AddHandler application/x-httpd-ea-php70
  </Directory>
</IfModule>

# suPHP configuration for ea-php71
<IfModule suphp_module>
  suPHP_Engine on
  <Directory />
    suPHP_AddHandler application/x-httpd-ea-php71
  </Directory>
</IfModule>

# suPHP configuration for ea-php72
<IfModule suphp_module>
  suPHP_Engine on
  <Directory />
    suPHP_AddHandler application/x-httpd-ea-php72
  </Directory>
</IfModule>

# Set ea-php56 as the system default for php
<IfModule mime_module>
  AddType application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>

# End of autogenerated php configuration.
The mysql my.cnf is:
Code:
# Optimized my.cnf configuration for MySQL/MariaSQL on cPanel/WHM servers
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# === Updated May 2018 ===
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have less or more resources available you should adjust accordingly to save CPU,
# RAM and disk I/O usage.
# The settings marked with a specific comment or the word "UPD" after the value
# should be adjusted for your system by using database diagnostics tools like:
# https://github.com/major/MySQLTuner-perl
# or
# https://launchpad.net/mysql-tuning-primer (supports MySQL up to v5.6)
#
#
# Note that if there is NO comment after a setting value, then 99,9% of the times you won't need to adjust it.
#
#
# THINGS TO DO AFTER YOU UPDATE MY.CNF - TROUBLESHOOTING
# If any terminal commands are mentioned, make sure you execute them as "root" user.
# If MySQL cannot start or restart, then perform the following actions.
#
# 1. If the server had the stock database configuration and you added or updated any
#    "innodb_log_*" settings (as suggested below), then execute these commands ONLY
#    the first time you apply this configuration:
#
#    $ rm -rvf /var/lib/mysql/ib_logfile*
#    $ touch /var/lib/mysql/mysql.sock
#    $ touch /var/lib/mysql/mysql.pid
#    $ chown -R mysql:mysql /var/lib/mysql
#    $ /scripts/restartsrv_mysql
#
#    or use the shorthand command:
#    $ rm -rvf /var/lib/mysql/ib_logfile*; touch /var/lib/mysql/mysql.sock; touch /var/lib/mysql/mysql.pid; chown -R mysql:mysql /var/lib/mysql; /scripts/restartsrv_mysql
#
#    IMPORTANT: If you edit this file from the Engintron WHM app in cPanel/WHM,
#    then you DO NOT need to execute the above terminal commands. When you save
#    the file through the Engintron WHM app, these terminal commands will be
#    executed automatically after the file is saved on disk.
#
# 2. If the setting "bind-address" is not commented out, then make sure the file /etc/hosts is
#    properly configured. A good example of a "clean" /etc/hosts file is something like this:
#
#    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#    ::1       localhost localhost.localdomain localhost6 localhost6.localdomain6
#    1.2.3.4   hostname.domain.tld hostname # Replace accordingly!
#
#    Finally restart the database using the related cPanel script:
#
#    $ /scripts/restartsrv_mysql
#
# 3. If the database service cannot restart even after the first 2 steps, make sure the database data folder
#    (common for either MySQL or MariaDB) "/var/lib/mysql" is owned by the "mysql" user AND group.
#    Additionally, the folder itself can have 0751 or 0755 file permissions. To fix it, simply do this:
#    $ chown -R mysql:mysql /var/lib/mysql
#    $ chmod 0755 /var/lib/mysql
#
#    Finally restart the database using the related cPanel script:
#
#    $ /scripts/restartsrv_mysql

[mysql]
port                            = 3306
socket                          = /var/lib/mysql/mysql.sock

[mysqld]
# Required Settings
basedir                         = /usr
bind_address                    = * # Change to 0.0.0.0 to allow remote servers to connect to this server's
                                            # database instance
datadir                         = /var/lib/mysql
max_allowed_packet=268435456
max_connect_errors              = 1000000
pid_file                        = /var/lib/mysql/mysql.pid
port                            = 3306
skip_external_locking
socket                          = /var/lib/mysql/mysql.sock
tmpdir                          = /tmp
user                            = mysql

# InnoDB Settings
default_storage_engine          = InnoDB
innodb_buffer_pool_instances    = 1     # Use 1 instance per 1GB of InnoDB pool size
innodb_buffer_pool_size         = 500M    # Use up to 70-80% of RAM & optionally check if /proc/sys/vm/swappiness is set to 0
innodb_file_per_table           = 1
innodb_flush_log_at_trx_commit  = 0
innodb_flush_method             = O_DIRECT
innodb_log_buffer_size          = 16M
innodb_log_file_size            = 128M
#innodb_thread_concurrency      = 4     # Optional: Set to the number of CPUs on your system (minus 1 or 2) to better
                                        # contain CPU usage. E.g. if your system has 8 CPUs, try 6 or 7 and check
                                        # the overall load produced by MySQL/MariaDB.

# MyISAM Settings
query_cache_limit               = 12M    # UPD
query_cache_size                = 75M   # UPD
query_cache_type                = 1

key_buffer_size                 = 1200M   # UPD

low_priority_updates            = 1
concurrent_insert               = 2

# Connection Settings
max_connections                 = 150   # UPD

back_log                        = 512
thread_cache_size               = 100
thread_stack                    = 192K

interactive_timeout             = 120
wait_timeout                    = 120

# Buffer Settings
join_buffer_size                = 4M    # UPD
read_buffer_size                = 2M    # UPD
read_rnd_buffer_size            = 4M    # UPD
sort_buffer_size                = 4M    # UPD

# Table Settings
# In systemd managed systems like CentOS 7, you need to perform an extra action for table_open_cache & open_files_limit
# to be overriden (also see comment next to open_files_limit).
# E.g. for MySQL 5.7 (when it's supported in cPanel), please check: https://dev.mysql.com/doc/refman/5.7/en/using-systemd.html
# and for MariaDB check: https://mariadb.com/kb/en/library/systemd/
table_definition_cache          = 8000  # UPD
table_open_cache                = 8000  # UPD
open_files_limit                = 32768 # UPD - This can be 2x to 3x the table_open_cache value or match the system's
                                        # open files limit usually set in /etc/sysctl.conf or /etc/security/limits.conf
                                        # In systemd managed systems this limit must also be set in:
                                        # /etc/systemd/system/mysqld.service.d/override.conf (for MySQL 5.7+) and
                                        # /etc/systemd/system/mariadb.service.d/override.conf (for MariaDB)

max_heap_table_size             = 128M
tmp_table_size                  = 128M

# Search Settings
ft_min_word_len                 = 3     # Minimum length of words to be indexed for search results

# Logging
log_error                       = /var/lib/mysql/mysql_error.log
log_queries_not_using_indexes   = 1
long_query_time                 = 5
slow_query_log                  = 0     # Disabled for production
slow_query_log_file             = /var/lib/mysql/mysql_slow.log

# Skip reverse DNS lookup of clients
# skip-name-resolve = 1

performance_schema = on

[mysqldump]
# Variable reference
# For MySQL 5.7: https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html
# For MariaDB:   https://mariadb.com/kb/en/library/mysqldump/
quick
quote_names
max_allowed_packet              = 64M
 

Tearabite

Well-Known Member
Nov 28, 2010
83
12
58
Southern California
cPanel Access Level
Root Administrator
I’m not an expert, and surely the experts will chime in with more info, but the first thing I see is very high load average on your TOP output..
Any time my average goes over 3 I get nervous..
My guess is your server is oversold/overloaded..
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463

shojib

Active Member
Mar 31, 2014
28
2
3
Sylhet, Bangladesh
cPanel Access Level
Root Administrator
Try installing opcache with this command:
yum install ea-php56-php-opcache ea-php70-php-opcache

Opcache can help you reduce overall PHP cpu usage if you are running your site under php-fpm.
Additionally, you can configure opcache by editing the following files:
/opt/cpanel/ea-php56/root/etc/php.d/opcache.ini
/opt/cpanel/ea-php70/root/etc/php.d/10-opcache.ini

Don't forget to restart php-fpm after you have made your changes on ini files with this command:
/scripts/restartsrv_apache_php_fpm

Hope this helps.
Shahriar
 
Last edited: