加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

Mysql内存占用太高,8G被耗光了查seesion占用办法

(2019-01-12 09:32:53)
分类: java
有一个后台daemon程序,运行期一直保持着数据库连接。并有频繁的数据插入。
数据库有500多个表,都会被频繁的使用。
数据库运行一段时间就会发现,8G的内存竟然会被吃光了。配置文件使用的是默认的my-medium.cnf文件。
希望大虾能够提示,这个问题应该从哪些方面考虑解决。
谢谢

数据库版本信息:
Server version: 5.1.46-log Source distribution

my.cnf文件,去除了中间部分注释

Example MySQL config file for medium systems.
#
This is for 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 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 program supports.
If you want to know which options 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]




查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            NULL             |
1114 monitor  122.11.48.138:45173 dn_monitor         Sleep            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      NULL  show processlist |
+------+----------+---------------------+--------------------+---------+------+-------+------------------+
10 rows in set (0.00 sec)

session看上去没太大的异常啊



0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有