Website loads forever

Re: Website loads forever

by Ken Task -
Number of replies: 3
Picture of Particularly helpful Moodlers

Well ... same physcial server ... same version of PHP shared by both sites.   Same DB server, only different DB's, shared by both sites.   Differences ... one is used the other is not.

So really can't guess if it's PHP ... shouldn't be, because one site works the other doesn't.   That leaves DB.

Do you have installed MySQLTuner.pl?

https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl

Get that installed and configured to run at your DB server.

You might see recommendations for tweaking my.cnf (DB server) settings that result in a solution.

You've also not mentioned specs of this all in one server.  

Memory?  HD space? Anything using swap space ... like DB server?   Any errors like ... 'Server has gone away' or connecions issues ... not for apache but for Moodle user doing something that starts a session with the DB.

IF you run 'top' is mysqld pegged at 100% of cpu when accessing the front page of the production server?

'spirit of sharing', Ken


In reply to Ken Task

Re: Website loads forever

by Armando Silva -

Went on a vacation, but I am still having the issue. So after investigating more, what I had thought was the same work environment was different. 

Working Site: 

Moodle 3.3 Build: 20170515

Apache: 2.2.15

Php: 5.6.30

mysql: Ver 14.14 Distrib 5.5.56, for Linux (x86_64) using readline 5.1

Non working Site: 

Moodle: 3.3 Build: 20170515

Apache: 2.2.15

Php: 7.1.5

mysql: Ver 14.14 Distrib 5.5.56, for Linux (x86_64) using readline 5.1


The difference is in php. Is 7.1.5 or 7.1 not compatible? I read on https://docs.moodle.org/dev/Moodle_3.3_release_notes that it is and openssl and fileinfo are required (which I have checked). When I run mysqltuner I get:


 >>  MySQLTuner 1.7.2 - Major Hayden <major@mhtx.net>

 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/

 >>  Run with '--help' for additional options and output filtering


[--] Skipped version check for MySQLTuner script

Please enter your MySQL administrative login: root

Please enter your MySQL administrative password: [OK] Currently running supported MySQL version 5.5.56

[OK] Operating on 64-bit architecture


-------- Log file Recommendations ------------------------------------------------------------------

[--] Log file: /var/log/mysqld.log(35K)

[OK] Log file /var/log/mysqld.log exists

[OK] Log file /var/log/mysqld.log is readable.

[OK] Log file /var/log/mysqld.log is not empty

[OK] Log file /var/log/mysqld.log is smaller than 32 Mb

[!!] /var/log/mysqld.log contains 10 warning(s).

[OK] /var/log/mysqld.log doesn't contain any error.

[--] 24 start(s) detected in /var/log/mysqld.log

[--] 1) 170601 12:37:22 [Note] /usr/libexec/mysqld: ready for connections.

[--] 2) 170601  9:48:14 [Note] /usr/libexec/mysqld: ready for connections.

[--] 3) 170531 13:58:10 [Note] /usr/libexec/mysqld: ready for connections.

[--] 4) 170530  7:27:53 [Note] /usr/libexec/mysqld: ready for connections.

[--] 5) 170512  8:47:19 [Note] /usr/libexec/mysqld: ready for connections.

[--] 6) 170504 10:37:07 [Note] /usr/libexec/mysqld: ready for connections.

[--] 7) 170503 11:51:05 [Note] /usr/libexec/mysqld: ready for connections.

[--] 8) 170503 11:46:34 [Note] /usr/libexec/mysqld: ready for connections.

[--] 9) 170302 13:35:26 [Note] /usr/libexec/mysqld: ready for connections.

[--] 10) 170302 13:24:51 [Note] /usr/libexec/mysqld: ready for connections.

[--] 20 shutdown(s) detected in /var/log/mysqld.log

[--] 1) 170601 12:37:20 [Note] /usr/libexec/mysqld: Shutdown complete

[--] 2) 170601  9:48:11 [Note] /usr/libexec/mysqld: Shutdown complete

[--] 3) 170531 13:58:05 [Note] /usr/libexec/mysqld: Shutdown complete

[--] 4) 170512  8:46:04 [Note] /usr/libexec/mysqld: Shutdown complete

[--] 5) 170504 10:35:54 [Note] /usr/libexec/mysqld: Shutdown complete

[--] 6) 170503 11:49:45 [Note] /usr/libexec/mysqld: Shutdown complete

[--] 7) 170503 11:46:27 [Note] /usr/libexec/mysqld: Shutdown complete

[--] 8) 170302 13:35:06 [Note] /usr/libexec/mysqld: Shutdown complete

[--] 9) 170302 13:24:32 [Note] /usr/libexec/mysqld: Shutdown complete

[--] 10) 170117 10:03:57 [Note] /usr/libexec/mysqld: Shutdown complete


-------- Storage Engine Statistics -----------------------------------------------------------------

[--] Status: +ARCHIVE +BLACKHOLE +CSV +FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA

[--] Data in MyISAM tables: 721M (Tables: 153)

[--] Data in InnoDB tables: 789M (Tables: 2486)

[!!] Total fragmented tables: 1


-------- 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: 12m 20s (3K q [4.924 qps], 19 conn, TX: 3M, RX: 383K)

[--] Reads / Writes: 94% / 6%

[--] Binary logging is disabled

[--] Physical Memory     : 3.7G

[--] Max MySQL memory    : 583.2M

[--] Other process memory: 631.0M

[--] Total buffers: 168.0M global + 2.8M per thread (151 max threads)

[--] P_S Max memory usage: 0B

[--] Galera GCache Max memory usage: 0B

[OK] Maximum reached memory usage: 176.2M (4.60% of installed RAM)

[OK] Maximum possible memory usage: 583.2M (15.22% of installed RAM)

[OK] Overall possible memory usage with other process is compatible with memory available

[OK] Slow queries: 0% (0/3K)

[OK] Highest usage of available connections: 1% (3/151)

[!!] Aborted connections: 10.53%  (2/19)

[!!] 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 / 348 selects)

[OK] Query cache prunes per day: 0

[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 38 sorts)

[OK] No joins without indexes

[!!] Temporary tables created on disk: 95% (406 on disk / 426 total)

[!!] Thread cache is disabled

[!!] Table cache hit rate: 3% (135 open / 3K opened)

[OK] Open file limit used: 0% (6/1K)

[OK] Table locks acquired immediately: 100% (2K immediate / 2K locks)


-------- Performance schema ------------------------------------------------------------------------

[--] Performance schema is disabled.

[--] Memory used by P_S: 0B

[--] Sys schema isn't installed.


-------- ThreadPool Metrics ------------------------------------------------------------------------

[--] ThreadPool stat is disabled.


-------- MyISAM Metrics ----------------------------------------------------------------------------

[!!] Key buffer used: 18.2% (1M used / 8M cache)

[!!] Key buffer size / total MyISAM indexes: 8.0M/114.5M


-------- InnoDB Metrics ----------------------------------------------------------------------------

[--] InnoDB is enabled.

[--] InnoDB Thread Concurrency: 0

[OK] InnoDB File per table is activated

[!!] InnoDB buffer pool / data size: 128.0M/789.7M

[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (7.8125 %): 5.0M * 2/128.0M should be equal 25%

[OK] InnoDB buffer pool instances: 1

[--] InnoDB Buffer Pool Chunk Size not used or defined in your version

[OK] InnoDB Read buffer efficiency: 99.88% (3958109 hits/ 3962967 total)

[OK] InnoDB Write log efficiency: 96.40% (196490 hits/ 203830 total)

[OK] InnoDB log waits: 0.00% (0 waits / 7340 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:

    Control warning line(s) into /var/log/mysqld.log file

    Run OPTIMIZE TABLE to defragment tables for better performance

      OPTIMIZE TABLE `ereferral`.`watchdog`; -- can free 89 MB

    Total freed space after theses OPTIMIZE TABLE : 89 Mb

    MySQL started within last 24 hours - recommendations may be inaccurate

    Enable the slow query log to troubleshoot bad queries

    Reduce or eliminate unclosed connections and network issues

    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

    Set thread_cache_size to 4 as a starting value

    Increase table_open_cache gradually to avoid file descriptor limits

    Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C

    Beware that open_files_limit (1024) variable

    should be greater than table_open_cache (400)

    Performance shouldn't be activated for MySQL and MariaDB 5.5 and lower version

    Consider installing Sys schema from https://github.com/mysql/mysql-sys

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)

    thread_cache_size (start at 4)

    table_open_cache (> 400)

    performance_schema = OFF disable PFS

    key_buffer_size (> 114.5M)

    innodb_buffer_pool_size (>= 789M) if possible.

    innodb_log_file_size * innodb_log_files_in_group should be equal to 1/4 of buffer pool size (=64M) if possible

In reply to Ken Task

Re: Website loads forever

by Armando Silva -
Now by reinstalling php 7.1, it seems that I have not uploaded all the packages. This time I am able to login, but get a 


Exception - Call to undefined function ldap_connect()

But that is really great that I could log in with an error. So then i just install the ldap package onto my server by:

yum install php-ldap 

And now it works! So two things I did:

1. Converted my database: https://docs.moodle.org/33/en/MySQL_full_unicode_support

2. Uninstalled php and reinstall it

In reply to Armando Silva

Re: Website loads forever

by Ken Task -
Picture of Particularly helpful Moodlers

Well, good to hear.   So it wasn't a single box but two boxen.   And on the one having troubles not everything installed.   Yep, that would do it. :\

The tuner output .... one suggestion related to this:

innodb_buffer_pool_size (>= 789M) if possible.

The buffer pool should equal to or slightly higher than the actual data.

1 GIg is't that far away from where you are at right now.

For every Gig that one has in buffer pools, one should have 1 buffer pool instanaces.

That setting is ok  right now, but when/if the site's data gets larger than buffer_pool_size, time to bump it up a little.

Sometimes, install php can be tricky ... via yum ... some extensions missing ... with a little more pratice one won't have to totally un-install and then re-install.   But ... as long as it works, right? ;)

It's a journey ... with no real end in sight!

'spirit of sharing', Ken