modifying Numa and IO scheduling to optimize MySQL performance

Source: Internet
Author: User

One. NUMA settings
Standalone single instance, it is recommended to turn off NUMA, there are three ways to shut down:
1. Hardware layer, set off in BIOS;
2.OS kernel, set numa=off at startup;
3. You can modify the memory allocation policy to Interleave (cross) with the Numactl command
Method 3
Modify Mysql.server 330 lines plus numactl
Vi/opt/mysql/bin/mysql.server

    • /usr/bin/numactl--interleave all $bindir/mysqld_safe--datadir= $datadir--pid-file= $server _pid_file $other _args > /dev/null 2>&1 &
    • Wait_for_pid created $!; Return_value=$?


Numastat Viewing memory Allocations

    • node0           node1
    • numa_hit& nbsp            56506002860    201877592362
    • numa_miss   & nbsp         9099468163      1450668930
    • numa_foreign           1450668930      9099468163
    • interleave_hit     & nbsp;     6205106         4793392
    • local_node            56485823400    201848609519
    • other_node     & nbsp;      9119647623      1479651773


Two. IO Scheduling algorithm
Linux has four IO scheduling algorithms: Cfq,deadline,anticipatory and NOOP,CFQ are the default IO scheduling algorithms. Under completely random access environment, the performance difference between CFQ and Deadline,noop is very small, but once a large continuous IO,CFQ may cause the response delay of small IO to increase, the database environment is proposed to be modified to deadline algorithm, and the performance is more stable.
The IO scheduling algorithm is based on disk design, so reducing head movement is one of the most important considerations, but after using flash storage devices, you no longer need to consider the problem of head movement, you can use the NOOP algorithm. The meaning of NoOp is nonoperation, which means that no IO optimizations are done, and the IO is handled exactly as requested in a FIFO manner.
IO Scheduler, default CFQ
echo ' deadline ' >/sys/block/sdb/queue/scheduler
Cat/sys/block/sdb/queue/scheduler

    • NoOp anticipatory [deadline] Cfq


Reduced read-ahead, default 128
Echo ' >/sys/block/sda/queue/read_ahead_kb
Increase queue, default 128
echo '/sys/block/sda/queue/nr_requests ' >
Try not to use swap zones, default 60
echo ' 0 ' >/proc/sys/vm/swappiness
Start-up operation
Vi/etc/rc.local

    • echo ' deadline ' >/sys/block/sdb/queue/scheduler
    • Echo ' >/sys/block/sda/queue/read_ahead_kb
    • echo '/sys/block/sda/queue/nr_requests ' >


Vi/etc/sysctl.conf

      • Vm.swappiness=0

modifying Numa and IO scheduling to optimize MySQL performance

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.