In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what are the practical commands for Linux system performance optimization". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Linux is a set of free-to-use and free-spread Unix-like operating system. Different distributions and different kernels of Linux have made changes to various parameters and settings, so that the system can achieve better performance.
Timing buffered disk reads: hdparm-t / dev/sda5 print: Timing buffered disk reads: 254 MB in 3.01 seconds = 84.34 MB/sec description: can specify which hard disk to query! 2 iostat iostat detects disk IO: format: iostat [- c |-d] [- k] [- t] [- V] [- x [device]] [interval] description: iostat is the abbreviation of iostat O disk (input / output statistics). The iostat tool will monitor the disk operation activity of the system. It is characterized by reporting disk activity statistics, as well as CPU usage. Like vmstat, iostat also has a weakness, that is, it cannot conduct in-depth analysis of a process, only the overall situation of the system is analyzed, and statistics are detected once every second (5 times in total).
Blocks read by blk_read/s per second
Blocks written by blk_wrtn/s per second
Blk_read indicates the number of all blocks read
Blk_wrtn indicates the number of all blocks written
3Jet vmstat reports memory and CPU status: name: statistics format for reporting virtual memory: vmstat [- n] [latency [times]]
R: the number of processes running and waiting for CPU time slices. The number of long-term CPU is greater than that of CPU. B: the number of processes waiting for resources, if the number of waits is large. The problem may lie in the Swpd O or memory Swpd: the amount of memory switched to the memory swap area [in KB] free: the current amount of physical memory free [in KB] si: transferred to memory from disk so: transferred to disk from memory bi: total amount of data read from block devices bo: total amount of data written to block devices bi+bo1000 if more than 1000 There is a problem with the read and write speed of the hard disk in: 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% represents insufficient CPU resources us: percentage of CPU time consumed by user processes sy: percentage of CPU time consumed by kernel processes percentage of time id:CPU is idle wa: Percentage of time spent waiting for IO runq-sz: number of processes that can be run in memory plist-sz: number of active tasks in the system 4 Sar detects CPU resources: task schedule / etc/cron.d/sysstat log directory / var/log/sa view method Sar-Q-f / var/log/sa/sa105,lscpu displays CPU information: dmesg displays boot information lscpu displays CPU information lscpu-p displays the number of nodes corresponding to CPU getconf LONG_BIT learns the number of digits of the host getconf-a view all parameters / sys/class/dmi/id can view Bios information bios_*
6The call of the display program of dint strace:
Strace-fc elinks-dump http://localhost7, tuned hard disk for priority write / read data:
❝
Read the amount that needs to be written in advance, and then process the write request, and the value read by ↑ will be half the ↑ of the set value.
Sets the higher the value read into the cache. Writing slows down because of the large amount of data.
The larger the queue length of / sys/block/sda/queue/nr_requests, the faster the IO speed of the hard disk, but takes up memory.
/ sys/block/sda/queue/scheduler scheduling algorithms Noop, anticipatory, deadline, [cfq]
8. Make the logging function of the Ext3 file system independent:
❝
1. Create 200m / dev/sdb1 formatted as ext32, dumpe2fs / dev/sdb1 to view has_journal3 contained in the file system function, Tune2fs-O ^ has_journal / dev/sdb1 remove the default original log function 4, and then divide into a 200m partition. / dev/sdb2. The block of the log volume must be equal to / dev/sdb1Mke2fs-O journal_dev-b 1024 / dev/sdb25, use / dev/sdb2 as the log volume of / dev/sdb1. Tune2fs-j-J device=/dev/sdb2 / dev/sdb19, turn off recording file system atime: for website files, frequent changes to atime are meaningless and will affect the performance of mount-o log. 10. Submit time to modify file log: the default is to submit the log every 5 seconds. Longer modifications can improve performance, but it is easy to lose data. Mount-o remount,commit=15 DEVICE11,RAID round-robin write tuning for 0-stroke 5-write 6:
❝
Chunk size. A byte that is written once in turn. The default is 64K. As long as it is not full, it will not move to the next device.
If only one file is written on each hard disk to switch to the next hard disk, then if there are all 1K small files, the system resources will be wasted on the switching hard disk.
If you set the value of chunk size to a large value, such as 100m, then it doesn't make any sense, you might as well use a hard drive.
Stripe size. The stripe size is not written as soon as there is data, but sets the amount of data written each time, usually 16K once.
So .chunk size (64K) / stripe size (16K), which means each hard disk is written four times.
-calculate how much chunk size should be adjusted at present.
Use iostat-x to view the average number of requests per second avgrq-sz since boot
Chunk size = requests per second * 512ax 1024 / disks, take the integer that is the most closely followed 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, hard disk block retention: dumpe2fs / dev/sda1 tune2fs-m 10 / dev/sda1 retention block percentage tune2fs-r retention block number reserved block is too little, affecting performance, too much retention and waste of hard disk, the default is 5% "what are the practical commands for Linux system performance optimization". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.