Home  >  Article  >  Database  >  MySQL Troubleshoting:Waiting on query cache mutex_MySQL

MySQL Troubleshoting:Waiting on query cache mutex_MySQL

WBOY
WBOYOriginal
2016-06-01 13:32:21991browse

bitsCN.com

MySQL Troubleshoting:Waiting on query cache mutex

 

今天被MySQL Query Cache 炕了、线上大量 Waiting on query cache mutex

     

     那么什么是 Query Cache?

     

MySQL Troubleshoting:Waiting on query cache mutex_MySQL

     

     QC 缓存的是整个SELECT的结果集、而非执行计划、QC的为人原则是:执行查询最快的方式就是不去执行

     但是、QC 简单粗暴的失效策略、令人蛋疼、任何不同(空格、TAB缩进、DML等)都会导致该表的Cache不可用

     失效通过single mutex 控制、有比较严重的锁竞争

     

     如何关闭QC?

     控制 2个参数:

     ① query_cache_type = off

     ② query_cache_size = 0

     

     总体而言、QC不建议使用、鸡肋功能、"夫鸡肋,弃之如可惜,食之无所得"、导致几十上百倍的性能差异

     如果、确实有这个缓存需求、应用允许的情况下、可用效率高的Redis或者MC等替代

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn