Slow Wordpress performance

5 posts / 0 new
Last post
#1 Sat, 05/13/2017 - 01:39
andrewww
andrewww's picture

Slow Wordpress performance

Hello Virtualmin People, I'm having some performance issues with virtual hosts. I have a server at home that hosts my website and a couple of mates websites. It also runs Zoneminder, a security system software package. It's a reasonably fast machine, Corei7, SSD, 8Gb RAM. All three virtual hosts run on Wordpress. My site is super slow to load, server response time is around 10 seconds. Once I've loaded the home page it seems to be OK, I can click around and it seems pretty snappy. I made another test virtual host and just put some basic HTML in an index file and it's super fast to load. So now I am thinking that it's a mySQL or Apache issue, but I don't really know how to look for the issue. The server doesn't seem to be loaded much, Webmin reports that the CPU is at max 4% most of the time and only about 1Gb of available 8Gb RAM used, I'm reasonably confident that there are sufficient resources of hardware to do what I want it to do, it's a pretty decent machine. I have Gigabyte internet and when I did a online load test nothing much happened, just consistently slow response times, but the server coped really well. It still didn't seem to be loaded much. Webmin and Virtualmin console is really snappy too, so is Zoneminder. It's doesn't feel slow when I doing anything else except trying to load my website in a browser. After poking about in the logs the only thing I can find is that each webmin user keeps getting admin privileges all the time:

May 13 18:00:06 ubuntu-server su[12054]: pam_unix(su:session): session closed for user jackselectrical
May 13 18:00:06 ubuntu-server systemd-logind[1070]: Removed session c7049.
May 13 18:00:06 ubuntu-server systemd: pam_unix(systemd-user:session): session closed for user jackselectrical
May 13 18:00:06 ubuntu-server su[12072]: Successful su for witham by root
May 13 18:00:06 ubuntu-server su[12072]: + ??? root:witham
May 13 18:00:06 ubuntu-server su[12072]: pam_unix(su:session): session opened for user witham by (uid=0)
May 13 18:00:06 ubuntu-server systemd-logind[1070]: New session c7050 of user witham.
May 13 18:00:06 ubuntu-server su[12072]: pam_unix(su:session): session closed for user witham
May 13 18:00:06 ubuntu-server systemd-logind[1070]: Removed session c7050.
May 13 18:00:06 ubuntu-server su[12078]: Successful su for test by root
May 13 18:00:06 ubuntu-server su[12078]: + ??? root:test
May 13 18:00:06 ubuntu-server su[12078]: pam_unix(su:session): session opened for user test by (uid=0)
May 13 18:00:06 ubuntu-server systemd-logind[1070]: New session c7051 of user test.
May 13 18:00:06 ubuntu-server systemd: pam_unix(systemd-user:session): session opened for user test by (uid=0)
May 13 18:00:06 ubuntu-server su[12078]: pam_unix(su:session): session closed for user test
May 13 18:00:06 ubuntu-server systemd-logind[1070]: Removed session c7051.
May 13 18:00:06 ubuntu-server su[12092]: Successful su for serpentservices by root
May 13 18:00:06 ubuntu-server su[12092]: + ??? root:serpentservices
May 13 18:00:06 ubuntu-server su[12092]: pam_unix(su:session): session opened for user serpentservices by (uid=0)
May 13 18:00:06 ubuntu-server systemd: pam_unix(systemd-user:session): session closed for user test
May 13 18:00:06 ubuntu-server systemd-logind[1070]: New session c7052 of user serpentservices.
May 13 18:00:06 ubuntu-server systemd: pam_unix(systemd-user:session): session opened for user serpentservices by (uid=0)
May 13 18:00:06 ubuntu-server su[12092]: pam_unix(su:session): session closed for user serpentservices
May 13 18:00:06 ubuntu-server systemd-logind[1070]: Removed session c7052.
May 13 18:00:06 ubuntu-server systemd: pam_unix(systemd-user:session): session closed for user serpentservices
May 13 18:05:01 ubuntu-server CRON[12295]: pam_unix(cron:session): session opened for user root by (uid=0)
May 13 18:05:01 ubuntu-server CRON[12295]: pam_unix(cron:session): session closed for user root
May 13 18:05:02 ubuntu-server su[12343]: Successful su for jackselectrical by root
May 13 18:05:02 ubuntu-server su[12343]: + ??? root:jackselectrical
May 13 18:05:02 ubuntu-server su[12343]: pam_unix(su:session): session opened for user jackselectrical by (uid=0)
May 13 18:05:02 ubuntu-server systemd-logind[1070]: New session c7053 of user jackselectrical.
May 13 18:05:02 ubuntu-server systemd: pam_unix(systemd-user:session): session opened for user jackselectrical by (uid=0)
May 13 18:05:02 ubuntu-server su[12343]: pam_unix(su:session): session closed for user jackselectrical
May 13 18:05:02 ubuntu-server systemd-logind[1070]: Removed session c7053.
May 13 18:05:02 ubuntu-server systemd: pam_unix(systemd-user:session): session closed for user jackselectrical
May 13 18:05:02 ubuntu-server su[12359]: Successful su for witham by root
May 13 18:05:02 ubuntu-server su[12359]: + ??? root:witham
May 13 18:05:02 ubuntu-server su[12359]: pam_unix(su:session): session opened for user witham by (uid=0)
May 13 18:05:02 ubuntu-server systemd-logind[1070]: New session c7054 of user witham.
May 13 18:05:02 ubuntu-server su[12359]: pam_unix(su:session): session closed for user witham
May 13 18:05:02 ubuntu-server systemd-logind[1070]: Removed session c7054.
May 13 18:05:02 ubuntu-server su[12365]: Successful su for test by root
May 13 18:05:02 ubuntu-server su[12365]: + ??? root:test
May 13 18:05:02 ubuntu-server su[12365]: pam_unix(su:session): session opened for user test by (uid=0)
May 13 18:05:02 ubuntu-server systemd-logind[1070]: New session c7055 of user test.
May 13 18:05:02 ubuntu-server systemd: pam_unix(systemd-user:session): session opened for user test by (uid=0)
May 13 18:05:02 ubuntu-server su[12365]: pam_unix(su:session): session closed for user test
May 13 18:05:02 ubuntu-server systemd-logind[1070]: Removed session c7055.
May 13 18:05:02 ubuntu-server su[12379]: Successful su for serpentservices by root
May 13 18:05:02 ubuntu-server su[12379]: + ??? root:serpentservices
May 13 18:05:02 ubuntu-server su[12379]: pam_unix(su:session): session opened for user serpentservices by (uid=0)
May 13 18:05:02 ubuntu-server systemd: pam_unix(systemd-user:session): session closed for user test
May 13 18:05:02 ubuntu-server systemd: pam_unix(systemd-user:session): session opened for user serpentservices by (uid=0)
May 13 18:05:02 ubuntu-server systemd-logind[1070]: New session c7056 of user serpentservices.
May 13 18:05:02 ubuntu-server su[12379]: pam_unix(su:session): session closed for user serpentservices
May 13 18:05:02 ubuntu-server systemd-logind[1070]: Removed session c7056.
May 13 18:05:02 ubuntu-server systemd: pam_unix(systemd-user:session): session closed for user serpentservices
May 13 18:09:01 ubuntu-server CRON[12544]: pam_unix(cron:session): session opened for user root by (uid=0)
May 13 18:09:01 ubuntu-server CRON[12544]: pam_unix(cron:session): session closed for user root
May 13 18:10:02 ubuntu-server su[12677]: Successful su for jackselectrical by root
May 13 18:10:02 ubuntu-server su[12677]: + ??? root:jackselectrical
May 13 18:10:02 ubuntu-server su[12677]: pam_unix(su:session): session opened for user jackselectrical by (uid=0)
May 13 18:10:02 ubuntu-server systemd-logind[1070]: New session c7057 of user jackselectrical.
May 13 18:10:02 ubuntu-server systemd: pam_unix(systemd-user:session): session opened for user jackselectrical by (uid=0)
May 13 18:10:02 ubuntu-server su[12677]: pam_unix(su:session): session closed for user jackselectrical
May 13 18:10:02 ubuntu-server systemd-logind[1070]: Removed session c7057.
May 13 18:10:02 ubuntu-server systemd: pam_unix(systemd-user:session): session closed for user jackselectrical
May 13 18:10:02 ubuntu-server su[12694]: Successful su for witham by root
May 13 18:10:02 ubuntu-server su[12694]: + ??? root:witham
May 13 18:10:02 ubuntu-server su[12694]: pam_unix(su:session): session opened for user witham by (uid=0)
May 13 18:10:02 ubuntu-server systemd-logind[1070]: New session c7058 of user witham.
May 13 18:10:02 ubuntu-server su[12694]: pam_unix(su:session): session closed for user witham
May 13 18:10:02 ubuntu-server systemd-logind[1070]: Removed session c7058.

I ran MySQL tuner and got this:

-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: /var/log/mysql/error.log(321B)
[OK] Log file /var/log/mysql/error.log exists
[OK] Log file /var/log/mysql/error.log is readable.
[OK] Log file /var/log/mysql/error.log is not empty
[OK] Log file /var/log/mysql/error.log is smaller than 32 Mb
[OK] /var/log/mysql/error.log doesn't contain any warning.
[OK] /var/log/mysql/error.log doesn't contain any error.
[--] 0 start(s) detected in /var/log/mysql/error.log
[--] 0 shutdown(s) detected in /var/log/mysql/error.log

-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA
[--] Data in InnoDB tables: 47M (Tables: 44)
[--] Data in MyISAM tables: 169K (Tables: 11)
[OK] Total fragmented tables: 0

-------- Security Recommendations ------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[!!] There is no basic password file list!

-------- CVE Security Recommendations --------------------------------------------------------------
[--] Skipped due to --cvefile option undefined

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 8d 1h 28m 37s (357K q [0.513 qps], 12K conn, TX: 1G, RX: 41M)
[--] Reads / Writes: 62% / 38%
[--] Binary logging is disabled
[--] Physical Memory     : 7.8G
[--] Max MySQL memory    : 352.4M
[--] Other process memory: 1.1G
[--] Total buffers: 192.0M global + 1.1M per thread (151 max threads)
[--] P_S Max memory usage: 72B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 212.2M (2.67% of installed RAM)
[OK] Maximum possible memory usage: 352.4M (4.44% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (0/357K)
[OK] Highest usage of available connections: 12% (19/151)
[OK] Aborted connections: 0.03%  (4/12857)
[!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
[!!] Query cache may be disabled by default due to mutex contention.
[!!] Query cache efficiency: 0.0% (0 cached / 200K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 19K sorts)
[OK] No joins without indexes
[!!] Temporary tables created on disk: 68% (5K on disk / 7K total)
[OK] Thread cache hit rate: 99% (43 created / 12K connections)
[OK] Table cache hit rate: 36% (416 open / 1K opened)
[OK] Open file limit used: 10% (109/1K)
[OK] Table locks acquired immediately: 100% (18K immediate / 18K locks)

-------- Performance schema ------------------------------------------------------------------------
[--] Memory used by P_S: 72B
[--] Sys schema is installed.

-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.4% (3M used / 16M cache)
[OK] Key buffer size / total MyISAM indexes: 16.0M/118.0K
[OK] Read Key buffer hit rate: 99.9% (63K cached / 44 reads)
[OK] Write Key buffer hit rate: 100.0% (5 cached / 5 writes)

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 128.0M/47.4M
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (75 %): 48.0M * 2/128.0M should be equal 25%
[OK] InnoDB buffer pool instances: 1
[--] Number of InnoDB Buffer Pool Chunk : 1 for 1 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[OK] InnoDB Read buffer efficiency: 99.99% (15464531 hits/ 15466414 total)
[!!] InnoDB Write Log efficiency: 87.68% (78393 hits/ 89405 total)
[OK] InnoDB log waits: 0.00% (0 waits / 167798 writes)

-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is disabled.

-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.

-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.

-------- RocksDB Metrics ---------------------------------------------------------------------------
[--] RocksDB is disabled.

-------- Spider Metrics ----------------------------------------------------------------------------
[--] Spider is disabled.

-------- Connect Metrics ---------------------------------------------------------------------------
[--] Connect is disabled.

-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.

-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] This is a standalone server.

-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
    Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries which have no LIMIT clause
Variables to adjust:
    query_cache_size (=0)
    query_cache_type (=0)
    query_cache_limit (> 1M, or use smaller result sets)
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    innodb_log_file_size * innodb_log_files_in_group should be equals to 1/4 of buffer pool size (=64M) if possible.

I don't really know what to do next. Any help with where to look would be much appreciated. Thanks, Andrew

Mon, 05/15/2017 - 01:56
Diabolico
Diabolico's picture

One option would be to turn on OpCache but i doubt it will help too much. TTFB of 10 seconds could indicate problems with MySQL or the system/hardware in general. Sadly for MySQL there isnt one settings for all and all comes down to trial and error, e.g. you must monitor your MySQL and make adjustments. MySQLtuner gives you just some idea what you could change but by no means you should follow every advice to the letter. For this you must have more than basic knowledge to properly modify MySQL and that means reading miles long documentation.

Picking some advice from Google could help but the equal chance is you could make the situation even worst. Either way if you decide to try by yourself save every config file before you start with modifications and do the modification manually using any SFTP software or SSH + Nano. Avoid modifying the config files over Virtualmin.

Best would be to hire a SysAdmin for one time job and let him to "fine tune" everything.

- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.

Wed, 11/21/2018 - 15:21
eiger3970

Any success with this? WordPress has destroyed my Virtualmin server. My own coded sites ran beautifully before using WordPress.

Fri, 11/23/2018 - 04:54 (Reply to #3)
adamjedgar

Say what????

I very much doubt wordpress is responsible for your issues...more likely server is configured incorrectly. There are thousands of servers all over the world that run flawlessly with wordpress....virtualmin ones included.

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Tue, 12/04/2018 - 09:15
Doemela

Give use your webserver directives doubt it is database default settings mostly good for any kind of cms I run several WP sites under nginx never had any problem.

Tried also that MySQLtuner it is ok but after while I did not bother and used MariaDB with default config this could be the webserver but host can also be the bottleneck here.

Topic locked