Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The first chapter of database optimization

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Hardware layer related optimization

1.1related to CPU

In the server's BIOS settings, you can adjust the following configurations to maximize CPU performance or to avoid classic NUMA problems:

1. Choose Performance Per Watt Optimized (DAPC) mode to maximize the performance of CPU. Do not consider saving power when running DB, a service that usually requires a high amount of computation.

2. Turn off options such as C1E and C States to improve CPU efficiency.

3. Memory Frequency (memory frequency) Select Maximum Performance (best performance)

4. In the memory settings menu, enable Node Interleaving to avoid NUMA problems.

1.2, disk Imax O related

The following are some measures that can be optimized for disk IOPS O, sorted by the magnitude of the improvement in performance:

1. When there is an array card, set the array write policy to WB, or even FORCE WB (if there is double electrical protection, or if the data security requirements are not particularly high), the use of WT policy is strictly prohibited.

2. Choose RAID-10 instead of RAID-5 whenever possible

3. If you use a mechanical disk, choose the one with high speed as much as possible, such as 15KRPM instead of 7.2KRPM.

2. System layer related optimization

2.1. File system layer optimization

1. The schedule of the SSD disk is noop.

2. The disk file should be xfs.

3. Add noatime, nodiratime and nobarrier to disk mount parameters.

2.2. Optimization of other kernel parameters

The purpose of setting appropriate values for key kernel parameters is to reduce the tendency of swap, and to prevent large fluctuations in memory and disk IPUBO, resulting in instantaneous peak load:

1. Set vm.swappiness to about 5-10, or even to 0 (if you are above RHEL 7, be careful to set it to 0, unless you allow OOM kill to happen) to reduce the chance of using SWAP.

2. Set vm.dirty_background_ratio to 5-10 and set vm.dirty_ratio to about twice as much as it, to ensure that dirty data can be continuously flushed to disk, avoiding instant write and serious waiting.

3. Set net.ipv4.tcp_tw_recycle and net.ipv4.tcp_tw_reuse to 1 to reduce TIME_WAIT and improve TCP efficiency.

Extraneous remarks

1. Let LINUX system support xfs file system.

1. Install the xfs support package

Yum-y install xfsprogs kmod-xfs xorg-x11-xfs xfsdump

2. Uninstall the previously suspended partition, such as changing sda2 to xfs partition.

Umount / dev/sda2

3. Format it into xfs format

Mkfs.xfs-f / dev/sda2

4. Re-mount

Mount-t xfs-o defaults,noatime,nodiratime / dev/sda2 / data

Reboot after writing to / etc/fstab file

/ dev/sda2 / data xfs defaults,noatime,nodiratime 1 2

2. Change the IO scheduling algorithm

# echo noop > / sys/block/vda/queue/scheduler

# time dd if=/dev/sda1 of=/dev/null bs=2M

# echo anticipatory > / sys/block/vda/queue/scheduler

Time dd if=/dev/sda1 of=/dev/null bs=2M

# echo cfq > / sys/block/sda/queue/scheduler

Time dd if=/dev/sda1 of=/dev/null bs=2M

View

Cat cat / sys/block/vda/queue/scheduler # vda refers to your current disk

Modify

Echo 'cfq' > / sys/block/vda/queue/scheduler

Effective immediately

3. Modify the memory scheduling algorithm (non-uniform memory access NUMA)

Check whether dmesg is supported | grep-I numa

The numactl-- hardware command returns information such as total memory size, available size, and node distance of different nodes.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report