【问题标题】:MariaDB Memory_used keep increasingMariaDB Memory_used 不断增加
【发布时间】:2016-03-23 16:13:26
【问题描述】:

我最近在更新到最新版本 (Mariadb 10.1.9) 后重新启动了我的 MariaDB (Mysql) 服务器。但从那以后,我的 nagios 报告使用的内存不断增加,我无法弄清楚它来自哪里。

使用的内存已被 Nagios 记录为 150.000,并且目前还在不断增加。今天早上的请求显示 620.000 :

查询警告:'SELECT ROUND(VARIABLE_VALUE/1024/1024) FROM information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME = "Memory_used"' 返回 620.000000

问题是否可能来自更新+重启,或者包更新后的不同配置文件或其他原因?

感谢您的帮助

更新

show variables like "%cache%"
Variable_name
Value
aria_pagecache_age_threshold
300
aria_pagecache_buffer_size
134217728
aria_pagecache_division_limit
100
aria_pagecache_file_hash_size
512
binlog_cache_size
32768
binlog_stmt_cache_size
32768
have_query_cache
YES
host_cache_size
279
innodb_disable_sort_file_cache
OFF
innodb_ft_cache_size
8000000
innodb_ft_result_cache_limit
2000000000
innodb_ft_total_cache_size
640000000
join_cache_level
2
key_cache_age_threshold
300
key_cache_block_size
1024
key_cache_division_limit
100
key_cache_file_hash_size
512
key_cache_segments
0
max_binlog_cache_size
18446744073709547520
max_binlog_stmt_cache_size
18446744073709547520
metadata_locks_cache_size
1024
query_cache_limit
1048576
query_cache_min_res_unit
4096
query_cache_size
1048576
query_cache_strip_comments
OFF
query_cache_type
OFF
query_cache_wlock_invalidate
OFF
stored_program_cache
256
table_definition_cache
400
table_open_cache
64
thread_cache_size
16


show variables like "%buffer%"
Variable_name
Value
aria_pagecache_buffer_size
134217728
aria_sort_buffer_size
268434432
bulk_insert_buffer_size
8388608
innodb_buffer_pool_dump_at_shutdown
OFF
innodb_buffer_pool_dump_now
OFF
innodb_buffer_pool_filename
ib_buffer_pool
innodb_buffer_pool_instances
8
innodb_buffer_pool_load_abort
OFF
innodb_buffer_pool_load_at_startup
OFF
innodb_buffer_pool_load_now
OFF
innodb_buffer_pool_populate
OFF
innodb_buffer_pool_size
134217728
innodb_change_buffer_max_size
25
innodb_change_buffering
all
innodb_log_buffer_size
16777216
innodb_sort_buffer_size
1048576
join_buffer_size
262144
join_buffer_space_limit
2097152
key_buffer_size
16777216
mrr_buffer_size
262144
myisam_sort_buffer_size
8388608
net_buffer_length
8192
preload_buffer_size
32768
read_buffer_size
262144
read_rnd_buffer_size
524288
sort_buffer_size
524288
sql_buffer_result
OFF

show variables like "%max_connections%"
Variable_name
Value
extra_max_connections
1
max_connections
151

【问题讨论】:

  • 能否也包括缓存和缓冲区变量?您还可以使用 mysqltuner 检查 MySQL 的最大配置内存使用量。
  • 是否有很多查询在一夜之间运行?操作系统(例如,“top”)是否也说 mysqld 大约有 620M?所有表中大约有多少数据(总计)?
  • @mihaly-vukovics 究竟是哪些变量,来自 information_schema ?我不得不重新启动我的 mysqld 服务器,因为该值变得至关重要,也许我需要等到使用的内存再次上升才能向您显示这些变量。
  • @rick-james 我只有几个数据库:Custom 11Mo,MediaWiki:127Mo,Prestashop:155Mo,Redmine:20Mo = 313 Mo。一些查询通过机器人爬行在 mediawiki 上运行,但没有什么疯狂的,因为通常我会期待。我刚刚重新启动了 mysqld,所以我稍后会检查“top”。
  • show variables like "%cache%";

标签: mysql memory mariadb


【解决方案1】:

缺少 3 个用于精确计算的参数: tmp_table_size, thread_stack, innodb_additional_mem_pool_size

但是对于您提供的配置,620MB 的内存消耗是正常的。 我假设升级还修改了 MariaDB 的配置文件。

【讨论】:

  • tmp_table_size: 16777216, thread_stack: 294912, innodb_additional_mem_pool_size: 8388608
  • 问题是我的 nagios 报告的 Memory_used 正常为 151.000,当我在这里发布时值为 620MB,但今天早上它超过了 1000MB,并被 Nagios 标记为严重。这就是我重新启动服务器的原因。
  • MariaDB 的总内存消耗应该在 600MB 左右(当所有 151 个连接都处于活动状态时!)。剩余的 400MB 由其他操作系统和非操作系统进程分配。使用 atop/top 实用程序检查其他进程的内存分配。
  • 我说的是今早返回 1029.000000 的 information_schema.GLOBAL_STATUS 的 Memory_used。我认为它与其他进程无关。另外,当我今天早上重新启动我的 mysql 服务器时,相同的变量会回到 151.000000,在我更新 mysql 服务器之前是 Memory_used 的常量值。
  • 很明显,更新改变了一些东西。操作系统报告的内存使用情况是多少?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-08-19
  • 2020-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多