转载: mysql在linux中的通用…

来源:互联网 发布:上海家博会数据 编辑:程序博客网 时间:2024/05/20 10:52
转自: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
1
2
# 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
1
2
# echo 0 >/proc/sys/vm/swappiness
add"vm.swappiness = 0" to /etc/sysctl.conf
  • Set numa interleave all
Shell
1
numactl --interleave=all

If using Percona Server we can place it into mysqld_safescript, 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 powersavemode enabled:
Check/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
and make sure it isnot ondemand
Check /proc/cpuinfo and compare cpuMHz number to what is listed under the “model name”
Disable the “ondemand” if it isrunning

Example: “ondemand” is running on all the servers

Shell
1
2
3
4
$ psax|grep kondemand|wc -l
65
$ cat/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
ondemand

and we have this:

Shell
1
2
3
4
/proc/cpuinfo:
model name: Intel(R) Xeon(R) CPU E5-4640 0 @ 2.40GHz
..
cpuMHz :1200.000

In this case we will need to disable “ondemand”.



Memory allocator = jemalloc (http://www.canonware.com/jemalloc/). It is used inPercona installation



setting the swappiness to zero means that if something fails themysqld might crash rather than going into swap, so its probablysafer to keep a bit of swapiness, not as high as the default, butsome, just in case…

also on demand governor might help you to keep the box on lowload, especially with small databases, but if you have a somewhatreasonable size database, it might make the performance on thedatabase better if you keep it running without ondemand.

for the grub parameter, deadline is really good, but readinginto kernel options, ive found the following kernel bootline moreeffective:

elevator=noop intel_iommu=on transparent_hugepage=alwaysacpi_irq_nobalance

irq_nobalance here is the parameter that gets things reallyrolling on an ubuntu server, it reduces the total load of thesystem by around 60%, as irq polling does not happen every second,i like to manage the irqs from bios anyways.


0 0
原创粉丝点击