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

What are the 12 performance tuning commands in linux system?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

In this issue, Xiaobian will bring you about the 12 performance tuning commands in the Linux system. The article is rich in content and analyzes and narrates from a professional perspective. After reading this article, I hope you can gain something.

R: Number of processes running and waiting for CPU time slices. Long-term greater than the number of CPUs, indicating insufficient CPU B: the number of processes waiting for resources, if the number of waiting is large, the problem may be I/O or memory Swpd: the memory size switched to the memory swap area [in KB]free: the amount of physical memory currently free [in KB]si: transferred from disk so: transferred from memory bi: the total amount of data read from block devices: bo The total amount of data written to the block device bi+bo1000 If it exceeds 1000, it means that there is a problem with the read and write speed of the hard disk in: the number of device interrupts per second observed in a certain time interval [too many interrupts are bad for performance]cs: column indicates the number of context switches per second us+sy > 80% indicates insufficient CPU resources us: Percentage of CPU time consumed by user processes sy: Percentage of CPU time consumed by kernel processes id: Percentage of time CPU is idle wa: Percentage of time IO waits runq-sz: Number of processes available to run in memory plist-sz: Number of active tasks in the system

4,sar Detect CPU resources:

Task Schedule/etc/cron.d/sysstat Log Directory/var/log/sa View Method Sar -q -f /var/log/sa/sa10

5,lscpu shows CPU information:

dmesg Display startup information lscpu Display CPU information lscpu -p Display CPU corresponding node getconf LONG_BIT Get host bits getconf -a View all parameters/sys/class/dmi/id View Bios information bios_*

6,strace shows the invocation of the program:

strace -fc elinks -dump http://localhost

7, optimize hard disk priority write/read data with:

Read the amount to be written in advance, and then process the write request. ↑ The value read will be half of the set value ↑.

Set the value read into cache to be larger. When writing, it will slow down due to the large amount of data.

The requested URL/sys/block/sda/queue/nr_requests/was not found on this server.

/sys/block/sda/queue/scheduler Scheduling algorithm Noop, anticipatory, deadline,[cfq]

8. Separate the logging function of Ext3 file system:

1. Create a 200 MB/dev/sdb1 formatted as ext32, dumpe2fs /dev/sdb1 View the file system features included in has_journal3, Tune2fs -O ^has_journal /dev/sdb1 Remove the default log feature 4. Divide into a 200 MB partition./ dev/sdb2. block of log volume must be equal to/dev/sdb1Mke2fs -O journal_dev -b 1024 /dev/sdb25, log volume with/dev/sdb2 as/dev/sdb1. Tune2fs-j -J device=/dev/sdb2 /dev/sdb1

9, Close the record file system atime:

For website files, frequent modification of atime is meaningless and will affect performance mount -o remount,noatime DEVICE

10. Submit time of modification file log:

The default is 5 seconds to submit a log, modify longer time can improve performance, but easy to lose data. mount -o remount,commit=15 DEVICE

11,RAID Round Robin Write Tuning, for 0/5/6:

chunk size. Round robin the bytes written at once. The default is 64K, as long as it is not full, it will not move to the next device.

Set to switch to the next hard disk after writing only one file on each hard disk, then if it is a small file of 1K, it will waste system resources on switching hard disks.

If the chunk size is set to a large value, such as 100M, then there is no point, it is better to use a hard disk.

Stripe size. Stripe size, not write data, but set the amount of data written each time, usually 16K write once.

Chunk size(64K)/stripe size(16K) means four writes per disk.

--------------------

Use iostat -x to see average requests per second since boot avgrq-sz

chunk size = requests per second *512/1024/disks, taken as the nearest integer multiple of 2

stride = chunk size /block(default is 4k)

Create raid and set chunk sinze

mdadm -C /dev/md0 -l 0 -n3 -chunk=8 /dev/sdb[123]

modify raid

mke2fs -j -b 4096 -E stride=2 /dev/md0

12. Number of blocks reserved for hard disk:

dumpe2fs /dev/sda1 tune2fs -m 10 /dev/sda1 percentage of blocks reserved tune2fs -r Number of blocks reserved Too few blocks reserved, affecting performance, too many reserved and wasting hard disks, default is 5%

After learning the above performance tuning commands and methods, I will summarize a few tuning golden sentences:

Stand-alone devices perform faster than integrated devices because they do not consume overall host resources

Engineers generally do not manage computers remotely and need to provide information such as logs

The larger the hard disk space, the slower the reading speed, you can consider using multiple hard disks to form a larger space

Partitioning is only done on the hard disk identification, unlike formatting is done on file system features, so fast

The faster the disk is on the outside, the faster it is.

Program developers focus on the functional requirements of employers, system administrators focus on the resource overhead of programs

The above is what the 12 performance tuning commands in the Linux system shared by Xiaobian are. If there is a similar doubt, please refer to the above analysis for understanding. If you want to know more about it, please pay attention to the industry information channel.

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

Servers

Wechat

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

12
Report