mysql_Qcahce

1、cpu           mem         disk    如果是固态硬盘ssd那就是高速公路
     火箭          高铁            普通公路

mysql   配置文件:windows 下   mysql.ini     linux:my.cnf
lamp路径:/opt/lamp/etc/my.cnf
yum安装:/etc/my.cnf
里面的[mysqld]下配置最大连接数
max_connections =1000,不设置默认100
wait _timeout=10  超时时间   

查看当前线程: 
show status like '%Threads_connected%';
show  processlist

qacache缓存的是查询的语句和结果集
qacache参数:  
query_cache_type = on//off是否开启查询缓存
query_cache_size =256//分配给查询缓存的总内存
query_cache_limit =1M //限制mysql缓存的最大结果。如果查询的结果比这个大,就不会被缓存

 查看缓存 连接状态
show varitables like '%query_cache%'
查看缓存使用情况
show status like 'Qcache%'
参数
Qcahce_free_blocks :Query Cache中目前还剩余多少blocks,如果该值显示较大,说明内存碎片比较多,FLUSH  QUERY  CACHE可以用来清除缓存碎片
Qcache_free_memory目前剩余内存大小
Qcache_hits  命中数
Qcache_inserts  没有命中,插入的数据
Qcache_not_cached   因为设置的缓存空间不足不能被cache的query数量
Qcahce_hits/Qcache_hits + Qcache_inserts    就是命中率
Qcahce-lowmem_prunes有多少条query是因为内存不足而被清除query
原文地址:https://www.cnblogs.com/lingxia/p/6292419.html