Linux

60 Saniyede Linux Sunucularda Performans Analizi

10 Kasım 2018

60 Saniyede Linux Sunucularda Performans Analizi

Performans analizlerini kısa tutmak makbuldür. Genelde uzun uzun yaptığımızda hem bize vakit açısından zararlıdır. Hemde müşteriyi bekletmiş oluruz. Tabii bu beklemenin yarısı metrikleri toplamak olmamalı, topladığımız metriği analiz etmek olmalı diye düşündüğüm için 60 saniyede linux sunucularda nasıl performans analizi yapabileceğinizi göstereceğim.

Aşağıdaki testlerin bazılarını yapmak için sisteminizde sysstat paketinin yüklü olması gerekmektedir.

Yük ortalamalarının kontrol edilmesi

root@debian:~# uptime
 01:06:02 up 4 min,  2 users,  load average: 0.97, 0.59, 0.25

Kernel hataları

root@debian:~# dmesg | tail
[  160.796031] raid6: sse2x4   gen() 14491 MB/s
[  160.864148] raid6: sse2x4   xor()  9278 MB/s
[  160.932032] raid6: avx2x1   gen() 18534 MB/s
[  161.000062] raid6: avx2x2   gen() 22065 MB/s
[  161.068124] raid6: avx2x4   gen() 23742 MB/s
[  161.068126] raid6: using algorithm avx2x4 gen() 23742 MB/s
[  161.068127] raid6: using avx2x2 recovery algorithm
[  161.209432] xor: automatically using best checksumming function   avx
[  161.264459] Btrfs loaded, crc32c=crc32c-intel
[  161.275961] fuse init (API version 7.26)

Zamana göre genel istatistikler

root@debian:~# vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 1309960  31768 500396    0    0   697  1502   21  941  6  3 66 25  0
 0  0      0 1309952  31768 500392    0    0     0     0   21   31  0  0 100  0  0
 0  0      0 1309952  31768 500392    0    0     0     0   18   29  0  0 100  0  0
 0  0      0 1309952  31776 500392    0    0     0    12   20   73  0  0 90 10  0
 0  0      0 1309952  31776 500392    0    0     0     0   18   26  0  0 100  0  0
 0  0      0 1309952  31776 500388    0    0     0     0   20   28  0  0 100  0  0
 0  0      0 1309952  31776 500388    0    0     0     0   19   30  0  0 100  0  0

İşlemci ortalamaları

root@debian:~# mpstat -P ALL 1
Linux 4.9.0-7-amd64 (debian)    11/08/2018      _x86_64_        (1 CPU)

01:10:42 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
01:10:43 AM  all    0.00    0.00    0.00    7.00    0.00    0.00    0.00    0.00    0.00   93.00
01:10:43 AM    0    0.00    0.00    0.00    7.00    0.00    0.00    0.00    0.00    0.00   93.00

01:10:43 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
01:10:44 AM  all    0.00    0.00    0.00    7.00    0.00    0.00    0.00    0.00    0.00   93.00
01:10:44 AM    0    0.00    0.00    0.00    7.00    0.00    0.00    0.00    0.00    0.00   93.00

01:10:44 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
01:10:45 AM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
01:10:45 AM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

Süreçlerin CPU kullanımı

root@debian:~# pidstat 1
Linux 4.9.0-7-amd64 (debian)    11/08/2018      _x86_64_        (1 CPU)

01:11:30 AM   UID       PID    %usr %system  %guest    %CPU   CPU  Command

01:11:31 AM   UID       PID    %usr %system  %guest    %CPU   CPU  Command
01:11:32 AM     0       161    0.00    1.00    0.00    1.00     0  kworker/0:1H

01:11:32 AM   UID       PID    %usr %system  %guest    %CPU   CPU  Command

01:11:33 AM   UID       PID    %usr %system  %guest    %CPU   CPU  Command
01:11:34 AM     0      8802    0.00    1.01    0.00    1.01     0  pidstat

Disk I/O kullanımı

root@debian:~# iostat -xz 1
Linux 4.9.0-7-amd64 (debian)    11/08/2018      _x86_64_        (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           3.17    0.00    1.92   15.41    0.00   79.49

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.90    24.93   11.86   23.23   374.90   870.94    71.01     0.54   15.33    8.92   18.61   4.81  16.87
dm-0              0.00     0.00    7.04   34.66   153.15   426.88    27.82     0.53   12.75   18.96   11.49   2.62  10.91
dm-1              0.00     0.00    2.16   10.05   124.88   370.82    81.18     0.63   51.37    5.20   61.29   4.98   6.08
dm-2              0.00     0.00    0.18    0.00     3.74     0.00    40.63     0.00    7.44    7.44    0.00   7.30   0.13
dm-3              0.00     0.00    0.28    0.32     5.21     0.51    19.14     0.02   37.50   11.43   60.42  12.61   0.75
dm-4              0.00     0.00    0.26    0.02     5.25     0.06    37.51     0.00   16.34   15.85   22.00  12.81   0.36

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00    0.00    0.00    0.00  100.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00    0.00    7.00    0.00   93.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     1.00    0.00    3.00     0.00    12.00     8.00     0.07   22.67    0.00   22.67  22.67   6.80
dm-1              0.00     0.00    0.00    3.00     0.00    12.00     8.00     0.07   22.67    0.00   22.67  22.67   6.80

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00    0.00    0.00    0.00  100.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00    0.00    0.00    0.00  100.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00    0.00    0.00    0.00  100.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util

Ram kullanımı

root@debian:~# free -m
              total        used        free      shared  buff/cache   available
Mem:           1921         122        1273           5         525        1643
Swap:          2043           0        2043

Network I/O kullanımı

root@debian:~# sar -n DEV 1
Linux 4.9.0-7-amd64 (debian)    11/08/2018      _x86_64_        (1 CPU)

01:13:42 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
01:13:43 AM      eth0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
01:13:43 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

01:13:43 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
01:13:44 AM      eth0      1.00      2.00      0.05      0.71      0.00      0.00      0.00      0.00
01:13:44 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

01:13:44 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
01:13:45 AM      eth0      1.01      2.02      0.05      0.69      0.00      0.00      0.00      0.00
01:13:45 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

TCP Kullanımı

root@debian:~# sar -n TCP,ETCP 1
Linux 4.9.0-7-amd64 (debian)    11/08/2018      _x86_64_        (1 CPU)

01:15:01 AM  active/s passive/s    iseg/s    oseg/s
01:15:02 AM      0.00      0.00      0.00      0.00

01:15:01 AM  atmptf/s  estres/s retrans/s isegerr/s   orsts/s
01:15:02 AM      0.00      0.00      0.00      0.00      0.00

01:15:02 AM  active/s passive/s    iseg/s    oseg/s
01:15:03 AM      0.00      0.00      1.01      2.02

01:15:02 AM  atmptf/s  estres/s retrans/s isegerr/s   orsts/s
01:15:03 AM      0.00      0.00      0.00      0.00      0.00

01:15:03 AM  active/s passive/s    iseg/s    oseg/s
01:15:04 AM      0.00      0.00      1.00      2.00

01:15:03 AM  atmptf/s  estres/s retrans/s isegerr/s   orsts/s
01:15:04 AM      0.00      0.00      0.00      0.00      0.00

01:15:04 AM  active/s passive/s    iseg/s    oseg/s
01:15:05 AM      0.00      0.00      1.00      2.00

01:15:04 AM  atmptf/s  estres/s retrans/s isegerr/s   orsts/s
01:15:05 AM      0.00      0.00      0.00      0.00      0.00

Genel kullanım

root@debian:~# top
top - 01:15:30 up 13 min,  2 users,  load average: 0.00, 0.10, 0.13
Tasks: 104 total,   1 running, 103 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.5 us,  1.5 sy,  0.0 ni, 83.8 id, 12.3 wa,  0.0 hi,  0.1 si,  0.0 st
KiB Mem :  1967800 total,  1303240 free,   126264 used,   538296 buff/cache
KiB Swap:  2093052 total,  2093052 free,        0 used.  1682356 avail Mem

   PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
     1 root      20   0   57256   6956   5272 S  0.0  0.4   0:01.15 systemd
     2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd
     3 root      20   0       0      0      0 S  0.0  0.0   0:00.10 ksoftirqd/0
     5 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kworker/0:0H
     7 root      20   0       0      0      0 S  0.0  0.0   0:00.09 rcu_sched
     8 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcu_bh
     9 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0
    10 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 lru-add-drain
    11 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 watchdog/0
    12 root      20   0       0      0      0 S  0.0  0.0   0:00.00 cpuhp/0
    13 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kdevtmpfs
    14 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 netns
    15 root      20   0       0      0      0 S  0.0  0.0   0:00.00 khungtaskd
    16 root      20   0       0      0      0 S  0.0  0.0   0:00.00 oom_reaper
    17 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 writeback
    18 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kcompactd0
    19 root      25   5       0      0      0 S  0.0  0.0   0:00.00 ksmd
    21 root      39  19       0      0      0 S  0.0  0.0   0:00.00 khugepaged
    22 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 crypto
    23 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kintegrityd
    24 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
    25 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kblockd
    26 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 devfreq_wq
    27 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 watchdogd
    28 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kswapd0
    29 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 vmstat
    41 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kthrotld
    43 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 ipv6_addrconf
    76 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 hv_vmbus_con
    77 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 ata_sff
    78 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
    79 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
    80 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
    81 root      20   0       0      0      0 S  0.0  0.0   0:00.38 scsi_eh_0
    82 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
    83 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
    84 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 scsi_tmf_0
    85 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
    86 root      20   0       0      0      0 S  0.0  0.0   0:00.43 scsi_eh_1
    87 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 scsi_tmf_1
    88 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
    89 root      20   0       0      0      0 S  0.0  0.0   0:00.04 kworker/u256:1
    90 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
    92 root      20   0       0      0      0 S  0.0  0.0   0:00.03 kworker/u256:2
    99 root      20   0       0      0      0 S  0.0  0.0   0:00.00 scsi_eh_2
   101 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 scsi_tmf_2
   117 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
   122 root      20   0       0      0      0 S  0.0  0.0   0:00.00 scsi_eh_3
   123 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 scsi_tmf_3
   157 root      20   0       0      0      0 S  0.0  0.0   0:00.72 kworker/0:3
   159 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
   161 root       0 -20       0      0      0 S  0.0  0.0   0:00.08 kworker/0:1H
   167 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kdmflush
   168 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset
   171 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kdmflush
   172 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset

Disk Kullanımı

root@debian:~# df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         950M     0  950M   0% /dev
tmpfs                        193M  5.3M  187M   3% /run
/dev/mapper/debian--vg-root  3.8G  874M  2.7G  25% /
tmpfs                        961M     0  961M   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        961M     0  961M   0% /sys/fs/cgroup
/dev/mapper/debian--vg-var   1.6G  198M  1.3G  14% /var
/dev/mapper/debian--vg-tmp   337M  2.1M  313M   1% /tmp
/dev/sda1                    236M   63M  162M  28% /boot
/dev/mapper/debian--vg-home   12G   41M   12G   1% /home
tmpfs                        193M     0  193M   0% /run/user/0
tmpfs                        193M     0  193M   0% /run/user/1000
Yorum yap

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir