设为首页 加入收藏

TOP

关于mysql出现大量locked进程 (二)
2014-11-24 03:07:24 来源: 作者: 【 】 浏览:5
Tags:关于 mysql 出现 大量 locked 进程
|
+------------+----------+-----------------------------------------------------------
mysql> show processlist;
+--------+---------+---------------------+--------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+--------+---------+---------------------+--------+---------+------+-------+------------------+
| 7572 | bbsuser | 61.152.X.89:1885 | wy**| Sleep | 4569 | | NULL |
| 235419 | bbsuser | 61.152.X.89:1935 | wy** | Sleep | 7 | | NULL |
| 262995 | root | localhost | NULL | Query | 0 | NULL | show processlist |
| 263404 | bbsuser | 61.152.X.76:53934 | wy** | Sleep | 93 | | NULL |
| 263948 | bbsuser | 61.152.X.76:54559 | wy** | Sleep | 9 | | NULL |
| 263986 | bbsuser | 61.152.X.76:54600 | wy** | Sleep | 4 | | NULL |
| 264005 | bbsuser | 61.152.X.76:54623 | wy** | Sleep | 1 | | NULL |
| 264010 | bbsuser | 61.152.X.76:54629 | wy** | Sleep | 0 | | NULL |
+--------+---------+---------------------+--------+---------+------+-------+------------------+
8 rows in set (0.00 sec)
1. 升级基本上没帮助
2. 改用innodb试试看
3. 优化你的sql
4. 优化你的索引,缓存等
5. 优化你的程序
6. 换更好的server
vi /etc/my.cnf

# 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-bdb
skip-innodb
skip-locking
back_log=500
skip-name-resolve
#interactive_timeout=20
#wait_timeout=5
#connect_timeout=10
max_connections=10000
key_buffer = 512M
max_allowed_packet = 4M
table_cache = 1024
sort_buffer_size = 32M
read_buffer_size = 32M
join_buffer_size=32M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 128M
thread_cache_size = 64
query_cache_limit=4M
query_cache_size = 64M
query_cache_type=1
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8


#
#skip-networking

# Replication Master Server (default)
# binary logging is required for replication
#log=/usr/local/mysql/data/mysql.log

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
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

[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout
很多时候MYISAM锁表是由于查询语句的问题,我公司的数据库也是这样的情况,我有次观察到连接量的高峰值竟会达到5000,当时觉得很奇怪,因为根据状态参数最多连接量也是百来个,抓取当时的快照才发现,都是LOCKED ,就象马路上的车一样一辆堵了引起整条路交通瘫痪,而首先引起LOCK的是一条很恶心的查询,而这条查询又频繁出现。
我觉得你还是得从分析引起LOCK的查询入手

摘自 yahohi的专栏
首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇MySQL中英文添加用户到启动 下一篇服务器端用 mysql_real_escape_st..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·如何利用Python做数 (2025-12-24 23:48:36)
·如何使用python进行 (2025-12-24 23:48:34)
·python 爬虫入门该怎 (2025-12-24 23:48:31)
·Java 实现多个大文件 (2025-12-24 23:22:00)
·Java多线程编程在工 (2025-12-24 23:21:56)