performance turning-linux

1 lsblk

[root@localhost]# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   1.1T  0 disk 
├─sda1   8:1    0     1G  0 part /boot
├─sda2   8:2    0   100G  0 part /
├─sda3   8:3    0   450G  0 part /backup
├─sda4   8:4    0     1K  0 part 
├─sda5   8:5    0   100G  0 part /u00
├─sda6   8:6    0   100G  0 part /var
├─sda7   8:7    0    50G  0 part /tmp
└─sda8   8:8    0 315.7G  0 part /logs
sdc      8:32   0 893.1G  0 disk 
└─sdc1   8:33   0 893.1G  0 part /data1
sdb      8:16   0 893.1G  0 disk 
sde      8:64   0 893.1G  0 disk 
├─sde1   8:65   0   450G  0 part /data3
└─sde2   8:66   0 443.1G  0 part /commitlog
sdd      8:48   0 893.1G  0 disk 
└─sdd1   8:49   0 893.1G  0 part /data2

2 smartctl

[root@localhost ~]# smartctl -a /dev/sda
smartctl 5.43 2016-09-28 r4347 [x86_64-linux-2.6.32-754.9.1.el6.x86_64] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

Vendor:               Cisco   
Product:              UCSC-MRAID12G   
Revision:             4.62
User Capacity:        1,198,999,470,080 bytes [1.19 TB]
Logical block size:   512 bytes
Logical Unit id:      0x6f80bcbeac41d2a023eec6c514c1ceb3
Serial number:        00b3cec114c5c6ee23a0d241acbebc80
Device type:          disk
Local Time is:        Fri Mar  1 02:47:43 2019 GMT
Device does not support SMART

3 iostat -x -p -t
-t 显示时间戳
-p 会把dev0-8之类转化为sda1.

sdc               0.00    40.23    0.99    2.12   144.29   338.80   155.52     0.02    7.68    0.36   11.09   0.21   0.06
sdc1              0.00    40.23    0.99    2.12   144.29   338.80   155.52     0.02    7.68    0.36   11.09   0.21   0.06
sdb               0.00     0.00    0.00    0.00     0.00     0.00    24.89     0.00    0.14    0.14    0.00   0.14   0.00
sde               0.00    80.05    0.20    2.97    16.89   664.23   214.30     0.02    7.20    0.39    7.66   0.34   0.11
sde1              0.00    19.64    0.20    1.03    16.88   165.34   147.84     0.01    9.42    0.38   11.21   0.22   0.03
sde2              0.00    60.42    0.00    1.95     0.00   498.89   256.40     0.01    5.79    3.80    5.79   0.42   0.08
sdd               0.00    38.47    1.80    2.01   237.10   323.88   147.09     0.02    5.95    0.35   10.95   0.20   0.07
sdd1              0.00    38.47    1.80    2.01   237.10   323.88   147.09     0.02    5.95    0.35   10.95   0.20   0.07

4 查看分区类型

[root@host ~]# cat /etc/fstab

UUID=74d82177-9ffd-4564-94d6-fc97cfdda575 / ext4 defaults 1 1
UUID=b6d58e19-7800-4284-96ae-615744a40f9d /backup ext4 defaults 1 2
UUID=465299be-d033-4e52-9359-125face600fc /boot ext2 defaults 1 2
UUID=cf442cbb-f33a-444d-be16-ae82a54a1802 /commitlog ext4 noatime 1 2
UUID=26c93b16-ce00-4f75-a17f-b56f7dcbd8ba /data1 ext4 noatime 1 2
UUID=65166b86-d9ac-41a8-be07-95c1e1d5e8d0 /data2 ext4 noatime 1 2
UUID=f1533b88-c494-41eb-8407-3951b5999486 /data3 ext4 noatime 1 2
UUID=c897ac33-7170-42d6-85c9-2d599e22dda0 /logs ext4 defaults 1 2
UUID=4cfed02e-31ea-4d09-970c-f906e3cc1c8a /tmp ext4 defaults 1 2
UUID=fbb944ee-6b21-4571-b1d8-2cc37e47538c /u00 ext4 defaults 1 2
UUID=fa2c170d-71b1-4707-a692-8a12c4d83706 /var ext4 defaults 1 2

5 pidstat

[root@host~]# pidstat -d 1
Linux 2.6.32-504.1.3.el6.x86_64 (tagrdbca01)    04/04/2019      _x86_64_        (32 CPU)

06:05:00 AM       PID   kB_rd/s   kB_wr/s kB_ccwr/s  Command
06:05:01 AM      1373   7384.62      0.00      0.00  rsync
06:05:01 AM      1375      0.00  11911.54      0.00  rsync
06:05:01 AM      1557      0.00     96.15      0.00  jbd2/sdd1-8
06:05:01 AM      4907      0.00      7.69      0.00  rsync
06:05:01 AM      5156      0.00      7.69      0.00  rsync
06:05:01 AM     18653    584.62    176.92      0.00  java
06:05:01 AM     19594      0.00     11.54      0.00  rsync

6 io information

  cd /sys/class/block/sdb/queue
[root@hostqueue]# ll
total 0
-rw-r--r-- 1 root root 4096 Apr  4 07:57 add_random
-r--r--r-- 1 root root 4096 Apr  4 07:00 discard_granularity
-r--r--r-- 1 root root 4096 Apr  4 07:57 discard_max_bytes
-r--r--r-- 1 root root 4096 Apr  4 07:57 discard_zeroes_data
-r--r--r-- 1 root root 4096 Apr  4 07:57 hw_sector_size
drwxr-xr-x 2 root root    0 Apr  4 07:57 iosched
-rw-r--r-- 1 root root 4096 Apr  4 07:57 iostats
-r--r--r-- 1 root root 4096 Apr  4 07:00 logical_block_size
-r--r--r-- 1 root root 4096 Apr  4 07:57 max_hw_sectors_kb
-rw-r--r-- 1 root root 4096 Apr  4 07:57 max_sectors_kb
-r--r--r-- 1 root root 4096 Apr  4 07:57 max_segments
-r--r--r-- 1 root root 4096 Apr  4 07:57 max_segment_size
-r--r--r-- 1 root root 4096 Apr  4 07:57 minimum_io_size
-rw-r--r-- 1 root root 4096 Apr  4 07:57 nomerges
-rw-r--r-- 1 root root 4096 Apr  4 07:57 nr_requests
-r--r--r-- 1 root root 4096 Apr  4 07:57 optimal_io_size
-r--r--r-- 1 root root 4096 Apr  4 07:57 physical_block_size
-rw-r--r-- 1 root root 4096 Aug 21  2018 read_ahead_kb
-rw-r--r-- 1 root root 4096 Aug 21  2018 rotational
-rw-r--r-- 1 root root 4096 Apr  4 07:57 rq_affinity
-rw-r--r-- 1 root root 4096 Aug 21  2018 scheduler
-rw-r--r-- 1 root root 4096 Apr  4 07:57 unpriv_sgio

7 修改io schedule

sudo echo noop > /sys/block/hda/queue/scheduler

Set the IO scheduler to either deadline or noop:
The noop scheduler is the right choice when the target block device is an array of SSDs behind a high-end IO controller that performs IO optimization.
The deadline scheduler optimizes requests to minimize IO latency. If in doubt, use the deadline scheduler.

发布者

傅, 健

程序员,Java、C++、开源爱好者. About me

发表评论

电子邮件地址不会被公开。 必填项已用*标注