Database keep on consuming RAM

Database keep on consuming RAM

by Liko Purba -
Number of replies: 1

Good day everyone

How to optimize database configuration on using RAM?

I'm using my moodle just for online quiz. For around 100 students. When the quiz is present, the RAM is increasing bit by bit and it's normal.
But after the quiz is finished and all users was logout, the RAM usage is not decreasing, it's still in high usage.

So how to set it up to make RAM usage goes back to normal usage when the moodle is in idle mode?

htop

edw

Moodle 3.10.1+
PHP 7.4
MariaDB 10.3.25
Nginx

Here is my CNF file for mariadb

[server]

[mysqld]

user                    = mysql
pid-file                = /run/mysqld/mysqld.pid
socket                  = /run/mysqld/mysqld.sock
#port                   = 3306
basedir                 = /usr
datadir                 = /var/lib/mysql
tmpdir                  = /tmp
lc-messages-dir         = /usr/share/mysql

skip-external-locking
skip_name_resolve
performance_schema      = ON

default_storage_engine          = InnoDB
innodb_buffer_pool_instances    = 3
innodb_buffer_pool_size         = 3G
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            = 256M
innodb_stats_on_metadata        = 0

innodb_read_io_threads          = 64
innodb_write_io_threads         = 64

bind-address            = 127.0.0.1

max_allowed_packet      = 256M
max_connect_errors      = 1000000

back_log                = 512
thread_cache_size       = 100
thread_stack            = 192K

interactive_timeout     = 180
wait_timeout            = 180

low_priority_updates    = 1
concurrent_insert       = 2

max_connections         = 150

query_cache_size        = 36M
query_cache_type        = 1
query_cache_min_res_unit = 2K

key_buffer_size         = 32M

#join_buffer_size        = 7M
#read_buffer_size        = 5M
#read_rnd_buffer_size    = 6M
#sort_buffer_size        = 6M

table_definition_cache  = 40000
table_open_cache        = 40000
open_files_limit        = 60000
max_heap_table_size     = 128M
tmp_table_size          = 128M

ft_min_word_len         = 3

log_error                       = /var/log/mysql/error.log
log_queries_not_using_indexes   = 1
long_query_time                 = 5
slow_query_log                  = 0
slow_query_log_file             = /var/lib/mysql/mysql_slow.log

expire_logs_days        = 10

character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci

[embedded]

[mariadb]

[mariadb-10.3]


Average of ratings: -
In reply to Liko Purba

Re: Database keep on consuming RAM

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
"RAM usage" in Linux is not something easy to follow. Here is the interpretation in Munin, as an example. The machine is only lightly loaded.

Attachment load-day.png
Attachment memory-day.png