2009년 6월 19일 금요일

Solaris 부하 측정 방법

<시스템 부하 측정>

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

    condition                      Conclusion

 

0 == r                             CPU idle

 

0 < r / ncpus < 3.0                No problem

 

3.0 <= r / ncpus <= 5              CPU busy

 

5.0 <= r /ncpus                    CPU very busy

 

smtx < 200                         No problem

 

200 <= smtx < 400          Mutex stall

 

400 <= smtx                        Mutex stall

 

- psrinfo | grep -c on (CPU 의 개수)

 

 

3. Swap space check

 

# vmstat 30

    Condition

 Conclusion

 

100,000K <= swap

 Swap waste

 

10,000K <= swap < 100,000K

 No problem

 

4,000K <= swap < 10,000K

 Swap low

 

1,000K <= swap < 4,000K

 Swap very low

 

swap < 1,000K

 No 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/vfstat

   /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을 삭제)

 

 

4. Memory 용량 check

 

# vmstat 30

    Condition

 Conclusion

 

sr == 0

 RAM waste

 

0 < sr < 200

 No problem

 

200 <= sr < 300

 Low RAM

 

300 <= sr

 Very low RAM

 

* Low RAM - 메모리를 증설해야 한다.

 

 

5. Disk 부하 check

 

# iostat -x 30

 

* svc_t (avque + avwait) : disk 응답시간

 

* 10 - 50 acceptable

 

* 100 - 1500 not acceptable

 

* %b : 디스크를 얼마나 많이 쓰는가?

 

* 5% 이하는 무시

 

* 60% 이상이면 조정할 필요가 있다.

 

 

6. Network 부하 Check

 

# netstat -i 30

    Condition

 Conclusion

 

(0

 Inactive network

 

(0

 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 nf

 Not Ethernet

 

* Busy Network - 네트워크에 너무나 많은 충돌이 생겨서 사용자들이 응답을 기다리는 늘어나 고 throughput이 감소한다. 만약 다른 네트워크가 있다면 부하를 주는 것을 부하가 없는 네트워크로 옮겨라. 또는 ATM 이나 100-MB Ethernet, FDDI같은 빠른 네트워크로 upgrade하라.

 

 

7. System error messages check

 

# vi /var/adm/messages

 

# cd /var/adm

 

# grep panic *

 

# grep error *

 

# grep warning *

 

 

8. 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)

 

 

9. 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에 등록해놓는다.

 




출처 jerry.lee | 제리
원본 http://blog.naver.com/jeeunglee/140015062952

댓글 없음:

댓글 쓰기