[ SUN 기술자료 ]
      23. 시스템 부하 측정
      
       1. 용량 확인
      1.1 Sun O/S 일 경우
      # df
      1.2 Solaris일 경우
      # df -k
      (참고)만약 root filesystem이 90% 이상일 경우 홈페이지에있는 find 명령어 사용법을 참조하여
      비정상적으로 생성된 file을 삭제하라. 그리고 root filesystem에 user의 directory가 있는지
      살펴 보아라. 특히 backup 시 device 명을 잘못 주어서 file로 저장되어서 시스템이 full 되는
      경우가 많음
      (참고) Find 명령어 사용법
      1. /usr에 50,000 characters보다 큰 화일 찾아라.
      # find /usr -type f -size +50000c -print
      2. core file을 삭제하라.
      # find / -name core -type f -exec rm {} \;
      3. /usr/src에서 이름이 mem*.c인것을 찾아라.
      # find /usr/src -type f -name "mem*.c" -print
      4. owner가 root이고 set-user-ID를 가지는 모든 화일을 찾아라.
      # find / -perm -04000 -user root -type f -exec ls -l {} \;
      5. 최근 이틀내에 쓰여진 화일을 찾아라.
      # find /usr -ctime -2 -print
      6. 최근 이틀내에 쓰여지고 크기가 10,000byte이상인 화일이나 디렉토리를 찾아라.
      # find /usr -ctime -2 -size +10000c -exec ls -l {} \;
       
       
       
      2. CPU 용량 check
      2.1 MP Control and Monitoring
      * Processor control and information
      * psrinfo - 사용가능한 CPU를 보여준다.
      # psrinfo
      0 on-line since 09/05/97 10:49:27
      2 on-line since 09/05/97 10:49:31
      * psradm - Enable or disable CPUs
      # psradm -f 2 -> 2번 CPU를 off-line
      # psrinfo
      0 on-line since 09/05/97 11:16:04
      2 off-line since 09/05/97 11:18:34
      # psradm -n -a -> 모든 process를 on-line
      2.2 CPU Rules for the SOlaris 2.x Operating Environment
      - vmstat 30 or mpstat 30
         conditionConclusion
            0 == rCPU idle
            0 < r / ncpus < 3.0No problem
            3.0 <= r / ncpus <= 5CPU busy
            5.0 <= r /ncpusCPU very busy
            smtx < 200No problem
            200 <= smtx < 400Mutex stall
            400 <= smtxMutex stall

       
      - psrinfo | grep -c on (CPU 의 개수)
      5. Swap space check
      # vmstat 30
         ConditionConclusion
            100,000K <= swap Swap waste
            10,000K <= swap < 100,000KNo problem
            4,000K <= swap < 10,000KSwap low
            1,000K <= swap < 4,000KSwap very low
            swap < 1,000KNo swap

      Action to Take
      * Swap Low - 실행되는 프로그램 수를 줄이고, swap space를 늘려라.
      * No Swap - 프로그램이 멈출 것이다. 즉시 swap space를 늘려라.
      (참고) Swap space 를 늘리려면
      1. Sun O/S 4.x 일경우
      # mkfile 40m /user/swap  (40mb size)
      # swapon /user/swap
      # pstat -T    (swap size 확인)
      # vi /etc/fstab
        /usr/swap   swap   swap   rw 0  0
      - swap file 삭제
      # rm /user/swap
      # vi /etc/fstab - add한 entry 를 삭제  
       
      2. Solaris 2.x 일 경우
      # /usr/sbin/mkfile 40m /user/swapfile 
      # swap -a /user/swapfile (O/S에 swap file을 추가함) 
      # swap -l 
      # vi /etc/vfstab 
         /user/swapfile    -    -    swap     -    no    -     ( 이라인을 추가)
      # swap -s
      total : 5828kbytes allocated + 2456k reserved = 8284k used, 103792k
      available
      ( allocated : 현재 사용, reserved : kernel이 잡아놓음 , available : 사용할수 있는양)
      # swap -d /user/swapfile (swap add한 file을 삭제)
                . 
       
      6. Memory 용량 check
      # vmstat 30
         ConditionConclusion
            sr == 0RAM waste
            0 < sr < 200No problem
            200 <= sr < 300Low RAM
            300 <= srVery low RAM

       
      * Low RAM - 메모리를 증설해야한다.
      7. Disk 부하 check
      # iostat -x 30
      * svc_t (avque + avwait) : disk 응답시간
      * 10 - 50 acceptable
      * 100 - 1500 not acceptable
      * %b : 디스크를 얼마나 많이 쓰는가?
      * 5% 이하는 무시
      * 60% 이상이면 조정할 필요가있다.
      8. Network 부하 Check
      # netstat -i 30
         ConditionConclusion
            (0<output packets<10)&&(100*output colls/(output
            packets)<0.5%)&&(other nets OK)Inactive network
            (0<output packets<10)&&(100*output.colls/(output
            packets)<1.5%)&&(other nets busy)Unbalanced
            (10<=output packets)&&(0.5%<=100*output colls/output packets
            <2.0%)No problem
            (10 <= output packets)&&(2.0%<=100*output colls/output
            packets<5.0%)Busy network
            (10<=output packets)&&(5.0%<=100*output colls/output packets)Very
            Busy Net
            network type is not ie,le,ne or qe;it is bf or nfNot Ethernet

       
      * Busy Network - 네트웍에 너무나 많은 충돌이 생겨서 사용자들이 응답을 기다리는 늘어나 고 throughput이
      감소한다. 만약 다른 네트웍이 있다면 부하를 주는 것을 부하가없는 네트웍 으로 옮겨라. 또는 ATM 이나 100-MB
      Ethernet, FDDI같은 빠른 네트웍으로 upgrade하라.
      9. System error messages check
      # vi /var/adm/messages
      # cd /var/adm
      # grep panic *
      # grep error *
      # grep warning *
      10. system 정보 출력
      # /usr/platform/'uname -i'/sbin/prtdiag  (this show usefull hardware
      information and failures of system)
      # /etc/prtvtoc  (show the detail information of disk slice  ex) prtvtoc
      /dev/dsk/c0t0d0s2)
      # /usr/sbin/eeprom (user can set some of variables of NVRAM via this
      command ex) eeprom boot-device=disk3)
      # /usr/sbin/prtconf -vp ( Shows device configuration )
      # devinfo -vp (Shows device configuration for Solaris 1.x)
      # /usr/sbin/sysdef  ( Shows software configuration  )
      # /usr/bin/dmesg | more ( collect system diagnostic messages to form error
      log  
      # /usr/proc/bin/ptree  (Process trees that contain the process)
      # /usr/proc/bin/pwdx pid ( Current working directory for a process)
      # /usr/proc/bin/pldd pid  ( Dynamic libraries linked into a process)
      # /usr/proc/bin/pmap pid  ( Address space map)
       
      11. Performance gathering script
              date >> /sunsolv/hangdata/vmstat.out
              vmstat 30 10 >> /sunsolv/hangdata/vmstat.out
              date >> /sunsolv/hangdata/iostat.out
              iostat -xtc 30 10 >> /sunsolv/hangdata/iostat.out
              date >> /sunsolv/hangdata/ps.out
              /usr/ucb/ps -aux >> /sunsolv/hangdata/ps.out
              date >> /sunsolv/hangdata/kmstat.out
              echo kmastat | crash >> /sunsolv/hangdata/kmstat.out
              date >> /sunsolv/hangdata/kernelmap.out
              echo "map kernelmap" | crash >> /sunsolv/hangdata/kernelmap.out
      위 명령어를 매 15분 마다 실행 하도록 crontab에 등록해놓는다.

'IT > Unix' 카테고리의 다른 글

backup 관련 명령어 요약  (0) 2009.02.25
DNS 설정  (0) 2009.02.05
fuser  (0) 2009.01.07
Clock board TOD does not match TOD on any IO board  (0) 2008.12.18
/etc/vfstab  (0) 2008.12.08

+ Recent posts