하드웨어 부하테스트 (Stress)

Posted by 주원이^^
2016. 7. 13. 10:39 리눅스/소프트웨어(Software)
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

LinuxStress 툴의 설치 및 사용방법

                                                                             작성자: 신 동 인

 

1. Kit확보방법

 - 아래의 url에서 source download 받음.

   http://weather.ou.edu/~apw/projects/stress/

   stress-1.0.0.tar.gz

 

2. ftp를 사용하여 원하는 시스템의 디렉토리로 이동

 

3. 압축의 해제

[root@krcipf3 stress]# tar -xzvf stress-1.0.0.tar.gz

stress-1.0.0/

stress-1.0.0/README

stress-1.0.0/configure.in

stress-1.0.0/aclocal.m4

stress-1.0.0/Makefile.am

stress-1.0.0/Makefile.in

stress-1.0.0/configure

stress-1.0.0/AUTHORS

stress-1.0.0/COPYING

stress-1.0.0/ChangeLog

stress-1.0.0/INSTALL

stress-1.0.0/NEWS

stress-1.0.0/TODO

stress-1.0.0/depcomp

stress-1.0.0/install-sh

stress-1.0.0/missing

stress-1.0.0/src/

stress-1.0.0/src/Makefile.am

stress-1.0.0/src/Makefile.in

stress-1.0.0/src/stress.c

stress-1.0.0/doc/

stress-1.0.0/doc/Makefile.am

stress-1.0.0/doc/Makefile.in

stress-1.0.0/doc/stamp-vti

stress-1.0.0/doc/version.texi

stress-1.0.0/doc/mdate-sh

stress-1.0.0/doc/texinfo.tex

stress-1.0.0/doc/stress.texi

stress-1.0.0/doc/stress.1

stress-1.0.0/doc/stress.html

stress-1.0.0/doc/stress.info

stress-1.0.0/test/

stress-1.0.0/test/Makefile.am

stress-1.0.0/test/Makefile.in

stress-1.0.0/test/check_version_return_code

stress-1.0.0/test/check_usage_return_code

 

4. 소스의 컴파일

[root@krcipf3 stress-1.0.0]# ./configure

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking for gcc... gcc

checking for C compiler default output file name... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ISO C89... none needed

checking for style of include used by make... GNU

checking dependency style of gcc... gcc3

checking how to run the C preprocessor... gcc -E

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking for unistd.h... (cached) yes

checking for sqrt in -lm... yes

checking for basename in -lgen... no

configure: creating ./config.status

config.status: creating Makefile

config.status: creating src/Makefile

config.status: creating doc/Makefile

config.status: creating test/Makefile

config.status: executing depfiles commands

[root@krcipf3 stress-1.0.0]# make

Making all in .

make[1]: Entering directory `/shindi/tools/stress/stress-1.0.0'

make[1]: `all-am'를 위해 할 일이 없습니다

make[1]: Leaving directory `/shindi/tools/stress/stress-1.0.0'

Making all in src

make[1]: Entering directory `/shindi/tools/stress/stress-1.0.0/src'

gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"stress\" -DVERSION=\"1.0.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBM=1 -I.     -Wall -Werror -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -MT stress.o -MD -MP -MF .deps/stress.Tpo -c -o stress.o stress.c

mv -f .deps/stress.Tpo .deps/stress.Po

gcc  -Wall -Werror -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE   -o stress stress.o  -lm

[root@krcipf3 stress-1.0.0]#

 

 

5. 실행파일 생성 확인

[root@krcipf3 stress-1.0.0]#

[root@krcipf3 stress-1.0.0]# cd src

[root@krcipf3 src]# ls -l stress

-rwxr-xr-x  1 root root 51993 10 21 16:50 stress

 

6. 실행테스트

[root@krcipf3 src]# ./stress --cpu 8 --timeout 60s  

   <-- 8 cpu에 돌아가는 것으로 8개 프로세스가 구동됨.

stress: info: [6950] dispatching hogs: 8 cpu, 0 io, 0 vm, 0 hdd

 

[root@krcipf3 ~]# vmstat 5

procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----

 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa

 9  0      0 3681888  47760 226752   0    0     0     7 2075    51 100  0  0  0

 9  0      0 3681952  47760 226752   0    0     0     0 2066    44 100  0  0  0

 9  0      0 3679776  47776 226736   0    0     0     6 2082    77 100  0  0  0

 9  0      0 3679200  47808 226704   0    0     0    31 2069    56 100  0  0  0

 9  0      0 3679200  47808 226704   0    0     0     0 2070    46 100  0  0  0

 

 

[root@krcipf3 src]# ./stress --vm 3 --vm-bytes 1024m  --timeout 60s

   <--  Memory load를 위해 2개의 process 1024M의 메모리를 사용

stress: info: [7147] dispatching hogs: 0 cpu, 0 io, 3 vm, 0 hdd

stress: info: [7147] successful run completed in 60s

[root@krcipf3 src]#

 

[root@krcipf3 ~]# vmstat 5

procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----

 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa

 4  0   8160 1452224  1952  22768    0    0     0     0 2063    48  7 93  0  0

 4  0   8160 3379968  1968  22752    0    0    26     0 2070    57  9 91  0  0

 4  0   8160 1816640  2016  24768    0    0    13     1 2066    87  7 93  0  0

 4  0   8160 2700224  2048  24736    0    0     0    34 2068    58  8 92  0  0

 4  0   8160 2366528  2048  24736    0    0     0     0 2061    53  7 93  0  0

 

[root@krcipf3 src]# stress --hdd 3 --hdd-bytes 1024m --timeout 60s

   <-- hard disk load를 위한 process수와 hard disk 테스트를 위한 파일의 크기를 정의

stress: info: [7301] dispatching hogs: 0 cpu, 0 io, 0 vm, 3 hdd

stress: info: [7301] successful run completed in 77s

[root@krcipf3 src]#

 

[root@krcipf3 ~]# vmstat 5

procs -----------memory---------- ---swap-- -----io----- --system-- ----cpu----

 r  b   swpd   free   buff  cache   si   so    bi     bo   in    cs us sy id wa

 0  5   8144 1914144  10448 1962576  0    0     5  11856 2200  1441  0 36  0 64

 4  5   8144 1600832  11664 2258576  0    0     2  70411 2211  1848  0 15  0 85

 0  7   8144 1090816  13600 2735488  0    0     3 226435 2204  1618  0 28  0 72

 0  7   8144 1929664  15152 1908336  0    0     3      0 2208  1742  0 20  0 80

 1  7   8144 2773504  15376 1101088  0    0     2     26 2205  1924  0 11  0 89

 

[root@krcipf3 src]# ./stress --cpu 5 --vm 3 --vm-bytes 512m --hdd 2 --hdd-bytes 1024m  --timeout 60s 

   <-- cpu, memory, and disk를 모두 테스트

stress: info: [7584] dispatching hogs: 5 cpu, 0 io, 3 vm, 2 hdd

stress: info: [7584] successful run completed in 64s

[root@krcipf3 src]#

 

[root@krcipf3 ~]# vmstat 5

procs -----------memory---------- ---swap-- -----io----  --system-- ----cpu----

 r  b   swpd   free   buff  cache   si   so    bi     bo   in    cs us sy id wa

11  4   8080 1430528  55952 1632048  0    0     0 143647 2197   762 50 50  0  0

10  5   8064 1131328  57680 1584928  0    0     0     20 2192    87 57 43  0  0

 9  4   8064 2387008  58048 472064   0    0     1 109312 2198    80 60 40  0  0

12  2   8064 2334624  58320 162192   0    0     0      2 2193    81 63 37  0  0

11  4   8064 1933120  60688 682016   0    0     0 129394 2143   131 55 45  0  0

 

시간: s,m,h,d,y     크기:k,m,g

 

7. stress툴의 사용방법관련 정보

# info stress 를 실행하면 사용방법에 대한 자세한 정보를 볼 수 있음.

 

 

'리눅스 > 소프트웨어(Software)' 카테고리의 다른 글

scp 쓰는법  (0) 2017.01.31
DNS 설치  (0) 2017.01.31
LVS Server2  (0) 2016.04.08
LVS Server1  (0) 2016.04.08
리눅스 본딩셋팅  (0) 2015.09.14

LVS Server2

Posted by 주원이^^
2016. 4. 8. 09:35 리눅스/소프트웨어(Software)
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

[Linux/CentOS7] Install LVS + Keepalived Server #2

※ Did you got the good news? Please click ad again, 좋은 정보 얻으셨다면 광고 한번 눌러주시는 센스 부탁드려요


This is the Redundant configuration for LVS + Keepalived Server itself.

This example is based on the environment below.



HTTP packets to the eth0 on LVS Server are forwarded to Backend01 and Backend02 Servers with NAT.

Change the default gateway to internal IP address of LVS on both Backend Web Servers first. (it's 10.0.0.29 on the example)



1. Install ipvsadm and keepalived.


[root@otaec ~]# yum -y install ipvsadm keepalived

# enable IP forward

[root@otaec ~]# echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf 

[root@otaec ~]# sysctl -p

[root@otaec ~]# touch /etc/sysconfig/ipvsadm 

[root@otaec ~]# systemctl start ipvsadm 

[root@otaec ~]# systemctl enable ipvsadm 






2. Configure Keepalived.

It's OK to configure the same settings except one setting on both backend servers. 

(but only for the "priority" section, Change it on both backend server.)


[root@otaec ~]# mv /etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf.org 

[root@otaec ~]# vi /etc/keepalived/keepalived.conf

# create new

global_defs {

    notification_email {

        root@otaec.server.world

    }

    notification_email_from root@otaec.server.world

    smtp_server 127.0.0.1

    smtp_connect_timeout 30

    router_id LVS_Server

}

vrrp_instance VI_1 {

    state BACKUP

    # monitored interface

    interface eth0

    # virtual router's ID

    virtual_router_id 51

    # set priority (change this value on each server)

    # (large number means priority is high)

    priority 100

    nopreempt

    # VRRP sending interval

    advert_int 1

    # authentication info between Keepalived servers

    authentication {

        auth_type PASS

        auth_pass password

    }


    virtual_ipaddress {

        # virtual IP address

        192.168.0.29 dev eth0

        10.0.0.29/24 dev eth1

    }

}

virtual_server 192.168.0.29 80 {

    # monitored interval

    delay_loop 3

    # distribution method

    lvs_sched rr

    # routing method

    lvs_method NAT

    protocol TCP


    # backend server#1

    real_server 10.0.0.51 80 {

        weight 1

        HTTP_GET {

            url {

                # monitored path

                path /

                # status code for normally state

                status_code 200

            }

            # timeout(sec)

            connect_timeout 3

        }

    }

    # backend server#2

    real_server 10.0.0.52 80 {

        weight 1

        HTTP_GET {

            url {

                path /

                status_code 200

            }

            connect_timeout 3

        }

    }

}


[root@otaec ~]# systemctl start keepalived 

[root@otaec ~]# systemctl enable keepalived 




[Linux/CentOS7] Install LVS + Keepalived Server #2

 

'리눅스 > 소프트웨어(Software)' 카테고리의 다른 글

DNS 설치  (0) 2017.01.31
하드웨어 부하테스트 (Stress)  (0) 2016.07.13
LVS Server1  (0) 2016.04.08
리눅스 본딩셋팅  (0) 2015.09.14
openssl 이용 키 생성 및 적용  (0) 2015.07.09

LVS Server1

Posted by 주원이^^
2016. 4. 8. 09:10 리눅스/소프트웨어(Software)
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

[Linux/CentOS7] Install LVS Server #1

※ Did you got the good news? Please click ad again, 좋은 정보 얻으셨다면 광고 한번 눌러주시는 센스 부탁드려요


Linux Virtual Server(LVS)란?

리눅스 가상 서버란, 한대의 서버로 증가하는 인터넷 사용자를 처리하기가 힘들어 지면서 
고가용성 서버를 구축하기 위해 리눅스 머신을 로드 발랜스 하도록 해주는 운영시스템이다.

만약 하나의 노드에서 처리량이 너무 많아서 서비스가 불가능할 경우 
간단히 하나의 노드를 병렬 구성으로 추가 함으로써 부하분산을 하도록 하는 것을 말한다. 
공개소스로서 이러한 기능을 담당하고 있는 것이다.

 

Configure LVS (Linux Virtual Server) to build a load barancer.
This example is based on the environment below.

 

 

 

1. Install ipvsadm.

 

[root@dlp ~]# yum -y install ipvsadm

 

 

 

 # enable IP forward
[root@dlp ~]# echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf 
[root@dlp ~]# sysctl -p
[root@dlp ~]# touch /etc/sysconfig/ipvsadm 
[root@dlp ~]# systemctl start ipvsadm 
[root@dlp ~]# systemctl enable ipvsadm

 

 

2. Configure Load Balancing.

 

 # clear tables
[root@dlp ~]# ipvsadm -C

 

 

 

# add virtual service
# [ ipvsadm -A -t (Service IP:Port) -s (Distribution method) ]
[root@dlp ~]# ipvsadm -A -t 192.168.0.30:80 -s wlc

 

 

 

# add backend real servers
# [ ipvsadm -a -t (Service IP:Port) -r (Real Server's IP:Port) -m ] ("m" means masquerading (NAT))
[root@dlp ~]# ipvsadm -a -t 192.168.0.30:80 -r 10.0.0.51:80 -m 
[root@dlp ~]# ipvsadm -a -t 192.168.0.30:80 -r 10.0.0.52:80 -m

 

 

 

# confirm tables
[root@dlp ~]# ipvsadm -l 
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  dlp.server.world:http wlc
  -> 10.0.0.51:http               Masq    1      0          0
  -> 10.0.0.52:http               Masq    1      0          0

 

 

 

rr Robin Robin 
 연결을 동일 순서대로 각 노드에 부하 분산한다.

wrr Weighted Round Robin 
 "-w weight '에 의해 설정된 weight에 따라 부하 분산한다.

lc Least-Connection 
 연결 수가 가장 낮은 노드에 부하 분산한다.

wlc Weighted Least-Connection 
 연결 수와 weight에 따라 부하 분산한다. 
 "-s (분산 방식)"을 지정하지 않으면 기본 분산 방식.

lblc Locality-Based Least-Connection 
 동일한 IP에서의 연결은 동일한 노드에 배분. 
 노드가 과부하 상태의 경우는 연결 수를 가진 노드에 부하 분산한다.

lblcr Locality-Based Least-Connection with Replication 
 동일한 IP에서의 연결은 가장 부하가 적은 노드에 배분. 
 모든 노드에 과부하 장소는 클러스터에서 연결 수를 가진 노드를 추가하여 부하 분산한다.

dh Destination Hashing 
 대상 IP에서 정적으로 할당 된 해시 테이블을 검색하여 부하 분산한다.

sh Source Hashing 
 소스 IP에서 정적으로 할당 된 해시 테이블을 검색하여 부하 분산한다.

sed Shortest Expected Delay 
 응답 속도가 가장 빠른 서버에 배분.

nq Never Queue 
 유휴 서버가 있으면 거기에 배분. 
 모든 서버가 사용 중이라면 가장 응답 속도가 빠른 서버에 배분.

 

[Linux/CentOS7] Install LVS Server #1

 

'리눅스 > 소프트웨어(Software)' 카테고리의 다른 글

하드웨어 부하테스트 (Stress)  (0) 2016.07.13
LVS Server2  (0) 2016.04.08
리눅스 본딩셋팅  (0) 2015.09.14
openssl 이용 키 생성 및 적용  (0) 2015.07.09
오픈메신저 설치법(openfire) + spark  (0) 2014.11.17