转载: mysql在linux中的通用…
2015-01-18 20:18
288 查看
转自:http://www.mysqlperformanceblog.com/2013/12/07/linux-performance-tuning-tips-mysql/
Filesystem
ext4 (or xfs), mount with noatime
Scheduler – use deadline or noop
Shell
# echo deadline >/sys/block/sda/queue/scheduler
add "elevator=deadline" to grub.conf
(For more info see
Linux Schedulers in TPCC like benchmark)
Memory
Swappiness and NUMA:
Shell
# echo 0 > /proc/sys/vm/swappiness
add "vm.swappiness = 0" to /etc/sysctl.conf
Set numa interleave all
Shell
numactl --interleave=all
If using Percona Server we can place it into mysqld_safe
script, as
Percona Server supports NUMA control.
Jeremy Cole blog contains
excellent overview of NUMA as well as
additional NUMA tools
(and do not forget about innodb_flush_method=O_DIRECT)
CPU
Make sure there is no powersave
mode enabled:
Check
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
and make sure it is
not ondemand
Check /proc/cpuinfo and compare cpu
MHz number to what is listed under the “model name”
Disable the “ondemand” if it is
running
Example: “ondemand” is running on all the servers
Shell
$ ps ax| grep kondemand|wc -l
65
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
ondemand
and we have this:
Shell
/proc/cpuinfo:
model name : Intel(R) Xeon(R) CPU E5-4640 0 @ 2.40GHz
..
cpu MHz : 1200.000
In this case we will need to disable “ondemand”.
Memory allocator = jemalloc (http://www.canonware.com/jemalloc/). It is used in
Percona installation
setting the swappiness to zero means that if something fails the
mysqld might crash rather than going into swap, so its probably
safer to keep a bit of swapiness, not as high as the default, but
some, just in case…
also on demand governor might help you to keep the box on low
load, especially with small databases, but if you have a somewhat
reasonable size database, it might make the performance on the
database better if you keep it running without ondemand.
for the grub parameter, deadline is really good, but reading
into kernel options, ive found the following kernel bootline more
effective:
elevator=noop intel_iommu=on transparent_hugepage=always
acpi_irq_nobalance
irq_nobalance here is the parameter that gets things really
rolling on an ubuntu server, it reduces the total load of the
system by around 60%, as irq polling does not happen every second,
i like to manage the irqs from bios anyways.
Filesystem
ext4 (or xfs), mount with noatime
Scheduler – use deadline or noop
Shell
# echo deadline >/sys/block/sda/queue/scheduler
add "elevator=deadline" to grub.conf
1 2 | # echo deadline >/sys/block/sda/queue/scheduler add "elevator=deadline" to grub.conf |
Linux Schedulers in TPCC like benchmark)
Memory
Swappiness and NUMA:
Shell
# echo 0 > /proc/sys/vm/swappiness
add "vm.swappiness = 0" to /etc/sysctl.conf
1 2 | # echo 0 > /proc/sys/vm/swappiness add "vm.swappiness = 0" to /etc/sysctl.conf |
Shell
numactl --interleave=all
1 | numactl --interleave=all |
script, as
Percona Server supports NUMA control.
Jeremy Cole blog contains
excellent overview of NUMA as well as
additional NUMA tools
(and do not forget about innodb_flush_method=O_DIRECT)
CPU
Make sure there is no powersave
mode enabled:
Check
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
and make sure it is
not ondemand
Check /proc/cpuinfo and compare cpu
MHz number to what is listed under the “model name”
Disable the “ondemand” if it is
running
Example: “ondemand” is running on all the servers
Shell
$ ps ax| grep kondemand|wc -l
65
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
ondemand
1 2 3 4 | $ ps ax| grep kondemand|wc -l 65 $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ondemand |
Shell
/proc/cpuinfo:
model name : Intel(R) Xeon(R) CPU E5-4640 0 @ 2.40GHz
..
cpu MHz : 1200.000
1 2 3 4 | /proc/cpuinfo: model name : Intel(R) Xeon(R) CPU E5-4640 0 @ 2.40GHz .. cpu MHz : 1200.000 |
Memory allocator = jemalloc (http://www.canonware.com/jemalloc/). It is used in
Percona installation
setting the swappiness to zero means that if something fails the
mysqld might crash rather than going into swap, so its probably
safer to keep a bit of swapiness, not as high as the default, but
some, just in case…
also on demand governor might help you to keep the box on low
load, especially with small databases, but if you have a somewhat
reasonable size database, it might make the performance on the
database better if you keep it running without ondemand.
for the grub parameter, deadline is really good, but reading
into kernel options, ive found the following kernel bootline more
effective:
elevator=noop intel_iommu=on transparent_hugepage=always
acpi_irq_nobalance
irq_nobalance here is the parameter that gets things really
rolling on an ubuntu server, it reduces the total load of the
system by around 60%, as irq polling does not happen every second,
i like to manage the irqs from bios anyways.
相关文章推荐
- 【转载】 linux-mysql-django…
- linux lds 链接脚本转载
- mysql linux环境下区分大小写问题
- 【原创】 linux-mysql …
- (转载)Linux Makefile(auto…
- 【原创】 linux-mysql E…
- linux常用svn命令 (转载)
- wdcp/linux/GNU mysql中文乱码处理
- 【转载】linux C …
- 【转载】Linux 彻底删除文件
- Linux Socket编程(转载)
- linux  top (转载)
- 深入分析 Linux 内核链表 (转载)
- 【原创】 linux-python-MySQL…
- linux 工作队列(转载)
- Linux 修改mysql root密码
- [转载]将archlinux 2013-06-01版,安装配置为个人工作站
- linux mysql 修改用户密码
- 【原创】 linux-mysql p…
- 【转载】 linux Python&…