IO :
- raid、no lvm、 ext4或xfs、ssd、IO调治计策
- Swap调解(不行使swap分区)
- /proc/sys/vm/swappiness的内容改成0(姑且)
-
- /etc/sysctl.conf上添加vm.swappiness=0(永世)
这个参数抉择了Linux是倾向于行使swap,照旧倾向于开释文件体系cache。在内存求助的环境下,数值越低越倾向于开释文件体系cache。虽然,这个参数只能镌汰行使swap的概率,并不能停止Linux行使swap。
修改MySQL的设置参数innodb_flush_method,开启O_DIRECT模式。这种环境下,InnoDB的buffer pool会直接绕过文件体系cache来会见磁盘,可是redo log仍旧会行使文件体系cache。值得留意的是,Redo log是覆写模式的,纵然行使了文件体系的cache,也不会占用太多
IO调治计策
- #echo deadline>/sys/block/sda/queue/scheduler #姑且修改为deadline
- 永世修改如下:
- vi /boot/grub/grub.conf
- 变动到如下内容:
- kernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/ elevator=deadline rhgb quiet
1.5.5 体系参数调解
Linux体系内核参数优化
- vim /etc/sysctl.conf
- net.ipv4.ip_local_port_range = 1024 65535 # 用户端口范畴
- net.ipv4.tcp_max_syn_backlog = 4096
- net.ipv4.tcp_fin_timeout = 30
- fs.file-max=65535 # 体系最大文件句柄,节制的是能打开文件最大数目
用户限定参数(mysql可以不配置以下设置)
- vim /etc/security/limits.conf
- * soft nproc 65535
- * hard nproc 65535
- * soft nofile 65535
- * hard nofile 65535
1.5.6 应用优化
营业应用和数据库应用独立,防火墙:iptables、selinux等其他无用处事(封锁):
- chkconfig --level 23456 acpid off
- chkconfig --level 23456 anacron off
- chkconfig --level 23456 autofs off
- chkconfig --level 23456 avahi-daemon off
- chkconfig --level 23456 bluetooth off
- chkconfig --level 23456 cups off
- chkconfig --level 23456 firstboot off
- chkconfig --level 23456 haldaemon off
- chkconfig --level 23456 hplip off
- chkconfig --level 23456 ip6tables off
- chkconfig --level 23456 iptables off
- chkconfig --level 23456 isdn off
- chkconfig --level 23456 pcscd off
- chkconfig --level 23456 sendmail off
- chkconfig --level 23456 yum-updatesd off
安装图形界面的处事器不要启动图形界面 runlevel 3,其它,思索未来我们的营业是否真的必要MySQL,照旧行使其他种类的数据库。用数据库的最高地步就是不消数据库。
1.6 数据库优化
SQL优化偏向:
执行打算、索引、SQL改写
架构优化偏向:
高可用架构、高机能架构、分库分表
1.6.1 数据库参数优化
调解:
实例整体(高级优化,扩展)
- thread_concurrency #并发线程数目个数
- sort_buffer_size #排序缓存
- read_buffer_size #次序读取缓存
- read_rnd_buffer_size #随机读取缓存
- key_buffer_size #索引缓存
- thread_cache_size #线程缓存(1G—>8, 2G—>16, 3G—>32, >3G—>64)
毗连层(基本优化)
(编辑:湖南网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|