User-Profile-Image
hankin
  • 5
  • centos7
  • docker
  • mysql
  • PostgreSQL
  • git/gitlab
  • ELK
  • python
    • python-Tornado
    • python-django
  • redis
  • nginx
  • kvm
  • proxmox
  • mongo
  • kubernetes
  • prometheus
  • GlusterFs
  • nfs
  • freeswitch
  • httpd
  • shell脚本
  • linux
  • fastdfs
  • nextcloud
  • openssl
  • openvpn
  • rabbitmq
  • sqlite
  • svn
  • java
  • ubuntu
  • vue2
  • wordpress
  • php
  • IOT物联网
  • 项目
  • 故障处理
  • 树莓派
  • 博客存档
  • 未分类
  • 杂项
  • #1742(无标题)
  • 新视野
  • 分类
    • 项目
    • 树莓派
    • 杂项
    • 未分类
    • 新视野
    • 故障处理
    • 博客存档
    • wordpress
    • vue2
    • ubuntu
    • svn
    • sqlite
    • shell脚本
    • redis
    • rabbitmq
    • python-django
    • python
    • proxmox
    • prometheus
    • PostgreSQL
    • php
    • openvpn
    • openssl
    • nginx
    • nfs
    • nextcloud
    • mysql
    • mongo
    • linux
    • kvm
    • kubernetes
    • java
    • IOT物联网
    • httpd
    • GlusterFs
    • git/gitlab
    • freeswitch
    • fastdfs
    • ELK
    • docker
    • centos7
  • 页面
    • #1742(无标题)
  • 友链
      请到[后台->主题设置->友情链接]中设置。
Help?

Please contact us on our email for need any support

Support
    首页   ›   mysql   ›   正文
mysql

mysql优化

2022-10-28 23:33:36
753  0 0

mysql配置优化,提升性能

1 利用多核性能

查看默认值
show variables like '%_io_threads'

  #默认使用4核
修改配置文件添加

参数不支持动态改变,需要把该参数加入my.cnf里,修改完后重启MySQL服务4
mysql8可直接使用命令SET PERSIST,重启有效

vim /etc/my.cnf
    innodb_read_io_threads=16                               
    innodb_write_io_threads=16          
    #使用16个核,允许值的范围在1~64         
    innodb_thread_concurrency=0         
    #这个参数设置为0时,表示不限制线程数
重启MySQL服务
systemctl restart mysql

2 修改连接数

查看默认最大连接数
show variables like '%max_connections%'

查看默认用户最大连接数
show variables like 'max_user_connections'


# 默认0 无限制

查看用户最大连接记录
show global status like 'Max_used_connections'

修改最大连接数
服务器响应的最大连接数值占服务器上限连接数值的比例值在10%以上                    
如果在10%以下,说明mysql服务器最大连接上限值设置过高                  
    Max_used_connections / max_connections >0.1

修改配置文件my.cnf                    
    max_connections=1280

mysql8可直接使用命令,重启有效                  
    SET PERSIST max_connections=1280
重启MySQL服务
systemctl restart mysql
评论 (0)

点击这里取消回复。

欢迎您 游客  

Copyright © 2025 网站备案号 : 蜀ICP备2022017747号
smarty_hankin 主题. Designed by hankin
主页
页面
  • #1742(无标题)
博主
tang.show
tang.show 管理员
linux、centos、docker 、k8s、mysql等技术相关的总结文档
210 文章 2 评论 201257 浏览
测试
测试