Hi Ken,
My Moodle server is a dedicated one on
LAMP Ubuntu 18.04, DIgital Ocean 32M, 4cpu (dedicated), 160GB SSD. There are 1450 active users on the system. K-12
I list the Mysqltuner metrices at the end.
Because of Covid, every class including primary is issuing home assignments on a daily basis. So there is at least 1 Assignment per day. There are also content resources etc. That is why the course load is high since the teacher supposedly needs the work for the entire year visible for both teachers and parents.
The problem started with PHP running out of memory. It wanted to allocate 2GB of memory just to login for users in such courses. So I suspected the tables were too large to be loaded and started examining tables and saw that the largest tables were: grades, grades-history, and logs. When I reduced the logs duration the log table size came down. Not so however, the grades_history. So that's where the post got started.
Obviously there are no clear guidelines on scaling of Moodle. When I scaled my server to twice the RAM, the problem of editing the Assignments did not change at all. Clearly there is a problem here that is not addressed anywhere.
-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 18h 52m 57s (7M q [106.242 qps], 43K conn, TX: 6G, RX: 1G)
[--] Reads / Writes: 82% / 18%
[--] Binary logging is disabled
[--] Physical Memory : 31.4G
[--] Max MySQL memory : 16.6G
[--] Other process memory: 1.4G
[--] Total buffers: 16.1G global + 1.1M per thread (500 max threads)
[--] P_S Max memory usage: 72B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 16.1G (51.28% of installed RAM)
[OK] Maximum possible memory usage: 16.6G (52.83% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (0/7M)
[OK] Highest usage of available connections: 5% (29/500)
[OK] Aborted connections: 0.00% (2/43688)
[!!] 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 / 5M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (1K temp sorts / 837K sorts)
[!!] Joins performed without indexes: 13497
[OK] Temporary tables created on disk: 11% (109K on disk / 975K total)
[OK] Thread cache hit rate: 99% (41 created / 43K connections)
[!!] Table cache hit rate: 3% (2K open / 64K opened)
[OK] Open file limit used: 0% (0/5K)
[OK] Table locks acquired immediately: 100% (12K immediate / 12K 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.2% (3M used / 16M cache)
[OK] Key buffer size / total MyISAM indexes: 16.0M/43.0K
[!!] Read Key buffer hit rate: 92.7% (96 cached / 7 reads)
-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 16.0G/15.8G
[OK] Ratio InnoDB log file size / InnoDB Buffer pool size: 2.0G * 2/16.0G should be equal 25%
[OK] InnoDB buffer pool instances: 16
[--] Number of InnoDB Buffer Pool Chunk : 128 for 16 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.93% (443671249 hits/ 443975362 total)
[!!] InnoDB Write Log efficiency: 32.75% (519856 hits/ 1587182 total)
[OK] InnoDB log waits: 0.00% (0 waits / 1067326 writes)
-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
MySQL started within last 24 hours - recommendations may be inaccurate
Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
Adjust your join queries to always utilize indexes
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 (5000) variable
should be greater than table_open_cache (2245)
Variables to adjust:
query_cache_size (=0)
query_cache_type (=0)
query_cache_limit (> 1M, or use smaller result sets)
join_buffer_size (> 256.0K, or always use indexes with joins)
table_open_cache (> 2245)