Mysql内存占用太高,8G被耗光了查seesion占用办法
(2019-01-12 09:32:53)| 分类: java |
有一个后台daemon程序,运行期一直保持着数据库连接。并有频繁的数据插入。
数据库有500多个表,都会被频繁的使用。
数据库运行一段时间就会发现,8G的内存竟然会被吃光了。配置文件使用的是默认的my-medium.cnf文件。
希望大虾能够提示,这个问题应该从哪些方面考虑解决。
谢谢
数据库版本信息:
Serverversion: 5.1.46-log Source distribution
my.cnf文件,去除了中间部分注释
#Example MySQL config file for medium systems.
#
#This is for a system with little memory (32M - 64M) where MySQL plays
#an important part, or systems up to 128M where MySQL is used together with
#other programs (such as a web server)
#
#You can copy this file to
#/etc/my.cnf to set global options,
#mysql-data-dir/my.cnf to set server-specific options (in this
#installation this directory is /usr/local/mysql/var) or
#~/.my.cnf to set user-specific options.
#
#In this file, you can use all long options that a program supports.
#If you want to know which options a program supports, run the program
#with the "--help" option.
#The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
#Here follows entries for some specific programs
#The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer_size= 16M
max_allowed_packet= 1M
table_open_cache= 64
sort_buffer_size= 512K
net_buffer_length= 8K
read_buffer_size= 256K
read_rnd_buffer_size= 512K
myisam_sort_buffer_size= 8M
#Replication Master Server (default)
#binary logging is required for replication
log-bin=mysql-bin
#binary logging format - mixed recommended
binlog_format=mixed
server-id = 1
[mysqldump]
quick
max_allowed_packet= 16M
[mysql]
no-auto-rehash
#Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size= 20M
sort_buffer_size= 20M
read_buffer= 2M
write_buffer= 2M
[mysqlhotcopy]
数据库有500多个表,都会被频繁的使用。
数据库运行一段时间就会发现,8G的内存竟然会被吃光了。配置文件使用的是默认的my-medium.cnf文件。
希望大虾能够提示,这个问题应该从哪些方面考虑解决。
谢谢
数据库版本信息:
Server
my.cnf文件,去除了中间部分注释
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
[client]
#password
port
socket
#
#
[mysqld]
port
socket
skip-locking
key_buffer_size
max_allowed_packet
table_open_cache
sort_buffer_size
net_buffer_length
read_buffer_size
read_rnd_buffer_size
myisam_sort_buffer_size
#
#
log-bin=mysql-bin
#
binlog_format=mixed
server-id
[mysqldump]
quick
max_allowed_packet
[mysql]
no-auto-rehash
#
#safe-updates
[myisamchk]
key_buffer_size
sort_buffer_size
read_buffer
write_buffer
[mysqlhotcopy]
查session占用的办法
mysql> show processlist;
+------+----------+---------------------+--------------------+---------+------+-------+------------------+
|Id | User | Host | db | Command | Time | State | Info |
+------+----------+---------------------+--------------------+---------+------+-------+------------------+
| 803 | monitor | 122.11.48.133:34882 | dn_monitor | Sleep | 223 | | NULL |
|1113 | monitor | 122.11.48.138:45172 | dn_monitor | Sleep | 4 | | NULL |
|1114 | monitor | 122.11.48.138:45173 | dn_monitor | Sleep | 4 | | NULL |
|1115 | iamadmin | 127.0.0.1:35192 | dn_monitor | Sleep | 19 | | NULL |
|1116 | iamadmin | 127.0.0.1:35193 | dn_monitor | Sleep | 19 | | NULL |
|1117 | iamadmin | 127.0.0.1:35194 | dn_monitor | Sleep | 19 | | NULL |
|1118 | iamadmin | 127.0.0.1:35195 | dn_monitor | Sleep | 19 | | NULL |
|1119 | iamadmin | 127.0.0.1:35196 | dn_monitor | Sleep | 19 | | NULL |
|1120 | monitor | 58.221.148.162:1899 | information_schema | Sleep | 1355 | | NULL |
|1451 | root | localhost | NULL | Query | 0 | NULL | show processlist |
+------+----------+---------------------+--------------------+---------+------+-------+------------------+
10rows in set (0.00 sec)
session看上去没太大的异常啊
+------+----------+---------------------+--------------------+---------+------+-------+------------------+
|
+------+----------+---------------------+--------------------+---------+------+-------+------------------+
|
|
|
|
|
|
|
|
|
|
+------+----------+---------------------+--------------------+---------+------+-------+------------------+
10
session看上去没太大的异常啊

加载中…