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数据库约束深入详解

《MySQL数据库约束深入详解》:本文主要介绍MySQL数据库约束,在MySQL数据库中,约束是用来限制进入表中的数据类型的一种技术,通过使用约束,可以确保数据的准确性、完整性和可靠性,需要的朋友... 目录一、数据库约束的概念二、约束类型三、NOT NULL 非空约束四、DEFAULT 默认值约束五、UN

MySQL 多表连接操作方法(INNER JOIN、LEFT JOIN、RIGHT JOIN、FULL OUTER JOIN)

《MySQL多表连接操作方法(INNERJOIN、LEFTJOIN、RIGHTJOIN、FULLOUTERJOIN)》多表连接是一种将两个或多个表中的数据组合在一起的SQL操作,通过连接,... 目录一、 什么是多表连接?二、 mysql 支持的连接类型三、 多表连接的语法四、实战示例 数据准备五、连接的性

MySQL中的分组和多表连接详解

《MySQL中的分组和多表连接详解》:本文主要介绍MySQL中的分组和多表连接的相关操作,本文通过实例代码给大家介绍的非常详细,感兴趣的朋友一起看看吧... 目录mysql中的分组和多表连接一、MySQL的分组(group javascriptby )二、多表连接(表连接会产生大量的数据垃圾)MySQL中的

MySQL 中的 JSON 查询案例详解

《MySQL中的JSON查询案例详解》:本文主要介绍MySQL的JSON查询的相关知识,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录mysql 的 jsON 路径格式基本结构路径组件详解特殊语法元素实际示例简单路径复杂路径简写操作符注意MySQL 的 J

Spring Boot 整合 SSE的高级实践(Server-Sent Events)

《SpringBoot整合SSE的高级实践(Server-SentEvents)》SSE(Server-SentEvents)是一种基于HTTP协议的单向通信机制,允许服务器向浏览器持续发送实... 目录1、简述2、Spring Boot 中的SSE实现2.1 添加依赖2.2 实现后端接口2.3 配置超时时

Windows 上如果忘记了 MySQL 密码 重置密码的两种方法

《Windows上如果忘记了MySQL密码重置密码的两种方法》:本文主要介绍Windows上如果忘记了MySQL密码重置密码的两种方法,本文通过两种方法结合实例代码给大家介绍的非常详细,感... 目录方法 1:以跳过权限验证模式启动 mysql 并重置密码方法 2:使用 my.ini 文件的临时配置在 Wi

MySQL重复数据处理的七种高效方法

《MySQL重复数据处理的七种高效方法》你是不是也曾遇到过这样的烦恼:明明系统测试时一切正常,上线后却频频出现重复数据,大批量导数据时,总有那么几条不听话的记录导致整个事务莫名回滚,今天,我就跟大家分... 目录1. 重复数据插入问题分析1.1 问题本质1.2 常见场景图2. 基础解决方案:使用异常捕获3.

SQL中redo log 刷⼊磁盘的常见方法

《SQL中redolog刷⼊磁盘的常见方法》本文主要介绍了SQL中redolog刷⼊磁盘的常见方法,将redolog刷入磁盘的方法确保了数据的持久性和一致性,下面就来具体介绍一下,感兴趣的可以了解... 目录Redo Log 刷入磁盘的方法Redo Log 刷入磁盘的过程代码示例(伪代码)在数据库系统中,r

mysql中的group by高级用法

《mysql中的groupby高级用法》MySQL中的GROUPBY是数据聚合分析的核心功能,主要用于将结果集按指定列分组,并结合聚合函数进行统计计算,下面给大家介绍mysql中的groupby用法... 目录一、基本语法与核心功能二、基础用法示例1. 单列分组统计2. 多列组合分组3. 与WHERE结合使

Mysql用户授权(GRANT)语法及示例解读

《Mysql用户授权(GRANT)语法及示例解读》:本文主要介绍Mysql用户授权(GRANT)语法及示例,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mysql用户授权(GRANT)语法授予用户权限语法GRANT语句中的<权限类型>的使用WITH GRANT