Diagnosing MySQL Server Freezes and Stalls, Sometimes Called Crashes

本文主要是介绍Diagnosing MySQL Server Freezes and Stalls, Sometimes Called Crashes,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!


Diagnosing MySQL Server Freezes and Stalls, Sometimes Called Crashes 

转到底部

https://support.oracle.com/epmos/adf/images/t.gif


https://support.oracle.com/epmos/adf/images/t.gif

In this Document

 

Purpose

 

 

Troubleshooting Steps

 

 

1. Check query cache free blocks count.

 

 

2. If using InnoDB, check SHOW ENGINE INNODB STATUS.

 

 

3. Check SHOW PROCESSLIST and search the knowledge base for the text of the values in the State column.

 

 

4. Open a service request.

 

 

References


APPLIES TO:

MySQL Server - Version 4.0 and later
Information in this document applies to any platform.

PURPOSE

Guide to diagnosing the cause of a MySQL Server freeze, stall or similar interruption to service.

TROUBLESHOOTING STEPS

This document is a work in progress with only limited content at this stage. You should open a service request if it does not provide sufficient information to resolve your problem.

This does not cover actual crashes of the MySQL server. Check your running process list using operating system tools like PS or Task Manager. If you see that mysqld is still running this is the guide for you. If it is not still running, check a 
guide to actual crashes.

1. Check query cache free blocks count.

 

SHOW GLOBAL STATUS LIKE 'qcache_free_blocks';
+-------------------------+-------+
| Variable_name           | Value |
+-------------------------+-------+
| Qcache_free_blocks      | 120045|
+-------------------------+-------+



If you see a value above 10,000 it is likely that you need to tune your query cache settings. If you see a value above 50,000 it is possible that removing entries from the query cache could be blocking queries from running. Check for query cache related entries in SHOW PROCESSLIST output. Depending on MySQL server version and the number of free entries the delays could be as much as several minutes. More recent versions bypass the query cache once a timeout expires. As a temporary measure use FLUSH QUERY CACHE to defragment the query cache. It may take several minutes to work. As a longer term solution, see the query cache tuning guide (not yet available). Note that the query cache was designed for sizes of a few megabytes to a few tens of megabytes. Larger sizes than those can have serious adverse performance consequences.

You may also see high CPU use on one CPU core if the query cache is the source of the problem. The query cache only uses one core.

2. If using InnoDB, check SHOW ENGINE INNODB STATUS.


Look at the end of the list of transactions for queries that have been running for many tens, hundreds or thousands of seconds. If you see many such queries, decide whether you can safely KILL them and do that until the problem is resolved. Then work on tuning the queries and setting innodb_thread_concurrency and innodb_concurrency_tickets appropriately.

3. Check SHOW PROCESSLIST and search the knowledge base for the text of the values in the State column.


Many of the states can indicate potential trouble sources and solutions.

4. Open a service request.


Tell us the symptoms, whether it was sudden and whether it has been happening regularly. We will also need this output:
 

SHOW PROCESSLIST;
SHOW ENGINE INNODB STATUS;


Both taken while the problem is happening.
Both a second time a minute or so later, ideally still during the problem. If it is ongoing, repeat a few times with a ten or so minute gap between runs.

 

SHOW VARIABLES;
SHOW GLOBAL STATUS;


Also provide the most recent few thousand lines of the MySQL error log. Do not just start when the problem started, we need at least a  few hundred lines before then, if those lines exist. Going back more than a few days is not necessary.

For longer term monitoring we may ask you to turn on the InnoDB monitor. This regularly writes InnoDB status information to the MySQL Server error log file (usually called <servername>.err in the MySQL data directory. This is useful for monitoring batch jobs or over time to catch periodic problems. To enable it enter this in the client mysql:

 

USE TEST;
CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;



To disable it after collecting data use:
 

USE TEST;
DROP TABLE innodb_monitor;

 

这篇关于Diagnosing MySQL Server Freezes and Stalls, Sometimes Called Crashes的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/222222

相关文章

MySQL 中的 CAST 函数详解及常见用法

《MySQL中的CAST函数详解及常见用法》CAST函数是MySQL中用于数据类型转换的重要函数,它允许你将一个值从一种数据类型转换为另一种数据类型,本文给大家介绍MySQL中的CAST... 目录mysql 中的 CAST 函数详解一、基本语法二、支持的数据类型三、常见用法示例1. 字符串转数字2. 数字

Mysql实现范围分区表(新增、删除、重组、查看)

《Mysql实现范围分区表(新增、删除、重组、查看)》MySQL分区表的四种类型(范围、哈希、列表、键值),主要介绍了范围分区的创建、查询、添加、删除及重组织操作,具有一定的参考价值,感兴趣的可以了解... 目录一、mysql分区表分类二、范围分区(Range Partitioning1、新建分区表:2、分

MySQL 定时新增分区的实现示例

《MySQL定时新增分区的实现示例》本文主要介绍了通过存储过程和定时任务实现MySQL分区的自动创建,解决大数据量下手动维护的繁琐问题,具有一定的参考价值,感兴趣的可以了解一下... mysql创建好分区之后,有时候会需要自动创建分区。比如,一些表数据量非常大,有些数据是热点数据,按照日期分区MululbU

SQL Server配置管理器无法打开的四种解决方法

《SQLServer配置管理器无法打开的四种解决方法》本文总结了SQLServer配置管理器无法打开的四种解决方法,文中通过图文示例介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的... 目录方法一:桌面图标进入方法二:运行窗口进入检查版本号对照表php方法三:查找文件路径方法四:检查 S

MySQL 删除数据详解(最新整理)

《MySQL删除数据详解(最新整理)》:本文主要介绍MySQL删除数据的相关知识,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录一、前言二、mysql 中的三种删除方式1.DELETE语句✅ 基本语法: 示例:2.TRUNCATE语句✅ 基本语

MySQL中查找重复值的实现

《MySQL中查找重复值的实现》查找重复值是一项常见需求,比如在数据清理、数据分析、数据质量检查等场景下,我们常常需要找出表中某列或多列的重复值,具有一定的参考价值,感兴趣的可以了解一下... 目录技术背景实现步骤方法一:使用GROUP BY和HAVING子句方法二:仅返回重复值方法三:返回完整记录方法四:

从入门到精通MySQL联合查询

《从入门到精通MySQL联合查询》:本文主要介绍从入门到精通MySQL联合查询,本文通过实例代码给大家介绍的非常详细,需要的朋友可以参考下... 目录摘要1. 多表联合查询时mysql内部原理2. 内连接3. 外连接4. 自连接5. 子查询6. 合并查询7. 插入查询结果摘要前面我们学习了数据库设计时要满

MySQL查询JSON数组字段包含特定字符串的方法

《MySQL查询JSON数组字段包含特定字符串的方法》在MySQL数据库中,当某个字段存储的是JSON数组,需要查询数组中包含特定字符串的记录时传统的LIKE语句无法直接使用,下面小编就为大家介绍两种... 目录问题背景解决方案对比1. 精确匹配方案(推荐)2. 模糊匹配方案参数化查询示例使用场景建议性能优

mysql表操作与查询功能详解

《mysql表操作与查询功能详解》本文系统讲解MySQL表操作与查询,涵盖创建、修改、复制表语法,基本查询结构及WHERE、GROUPBY等子句,本文结合实例代码给大家介绍的非常详细,感兴趣的朋友跟随... 目录01.表的操作1.1表操作概览1.2创建表1.3修改表1.4复制表02.基本查询操作2.1 SE

MySQL中的锁机制详解之全局锁,表级锁,行级锁

《MySQL中的锁机制详解之全局锁,表级锁,行级锁》MySQL锁机制通过全局、表级、行级锁控制并发,保障数据一致性与隔离性,全局锁适用于全库备份,表级锁适合读多写少场景,行级锁(InnoDB)实现高并... 目录一、锁机制基础:从并发问题到锁分类1.1 并发访问的三大问题1.2 锁的核心作用1.3 锁粒度分