본문 바로가기

programming/Linux

netperf 우분투 네트워크 성능 측정 도구(ubuntu network performance tool)

1. netperf란?

2. netperf 설치

3. netperf 사용법

4. netperf 상세 사용법


1. netperf란?

netperf 실행 모습

Netperf 는 네트워크의 두 호스트간에 네트워크 대역폭 테스트 를 제공하는 소프트웨어 응용 프로그램입니다 . BSD 소켓을 통해 Unix 도메인 소켓 , TCP , SCTP , DLPI 및 UDP를 지원합니다. Netperf는 예를 들어 벌크 (단방향) 데이터 전송을 측정하거나 응답 성능을 요청하기 위해 사전 정의 된 여러 테스트를 제공합니다.

 

2. netperf 설치법

apt-get install으로 성능 검사하는 우분투와 서버 우분투 두곳에 설치하면 됩니다.

$apt-get install netperf

 

3. netperf 사용법

3.1 server에서 netserver

먼저 서버로 쓸 우분투에 netserver을 실행해야 합니다.

$netserver
Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC
$netserver -p 10001
Starting netserver with host 'IN(6)ADDR_ANY' port '10001' and family AF_UNSPEC

 기본 포트로 12865를 사용하지만 -p 옵션으로 포트를 지정할 수 있습니다.

 

3.2 client에서 netperf

$netperf -H (서버아이피)
$netperf -H (서버아이피) port (포트번호)
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to localhost () port 0 AF_INET : demo
Recv   Send    Send                          
Socket Socket  Message  Elapsed              
Size   Size    Size     Time     Throughput  
bytes  bytes   bytes    secs.    10^6bits/sec  

 87380  16384  16384    10.00    40345.35

위와 같이 기본 실행결과 10초간 측정 후 결과를 나타냅니다.

4. netperf 상세 사용법

netperf -h

Usage: netperf [global options] -- [test options] 

Global options:
    -a send,recv      Set the local send,recv buffer alignment
    -A send,recv      Set the remote send,recv buffer alignment
    -B brandstr       Specify a string to be emitted with brief output
    -c [cpu_rate]     Report local CPU usage
    -C [cpu_rate]     Report remote CPU usage
    -d                Increase debugging output
    -D time,[units] * Display interim results at least every time interval
                      using units as the initial guess for units per second
                      A negative value for time will make heavy use of the
                      system's timestamping functionality
    -f G|M|K|g|m|k    Set the output units
    -F lfill[,rfill]* Pre-fill buffers with data from specified file
    -h                Display this text
    -H name|ip,fam *  Specify the target machine and/or local ip and family
    -i max,min        Specify the max and min number of iterations (15,1)
    -I lvl[,intvl]    Specify confidence level (95 or 99) (99) 
                      and confidence interval in percentage (10)
    -j                Keep additional timing statistics
    -l testlen        Specify test duration (>0 secs) (<0 bytes|trans)
    -L name|ip,fam *  Specify the local ip|name and address family
    -o send,recv      Set the local send,recv buffer offsets
    -O send,recv      Set the remote send,recv buffer offset
    -n numcpu         Set the number of processors for CPU util
    -N                Establish no control connection, do 'send' side only
    -p port,lport*    Specify netserver port number and/or local port
    -P 0|1            Don't/Do display test headers
    -r                Allow confidence to be hit on result only
    -s seconds        Wait seconds between test setup and test start
    -S                Set SO_KEEPALIVE on the data connection
    -t testname       Specify test to perform
    -T lcpu,rcpu      Request netperf/netserver be bound to local/remote cpu
    -v verbosity      Specify the verbosity level
    -W send,recv      Set the number of send,recv buffers
    -v level          Set the verbosity level (default 1, min 0)
    -V                Display the netperf version and exit
    -y local,remote   Set the socket priority
    -Y local,remote   Set the IP_TOS. Use hexadecimal.
    -Z passphrase     Set and pass to netserver a passphrase

For those options taking two parms, at least one must be specified;
specifying one value without a comma will set both parms to that
value, specifying a value with a leading comma will set just the second
parm, a value with a trailing comma will set just the first. To set
each parm to unique values, specify both and separate them with a
comma.

* For these options taking two parms, specifying one value with no comma
will only set the first parms and will leave the second at the default
value. To set the second value it must be preceded with a comma or be a
comma-separated pair. This is to retain previous netperf behaviour.

자주사용하는 사용법으로는 

4.1

netperf -H (서버아이피) port (포트) -l (테스트시간) -- -m (패킷싸이즈[B])

test time과 Send Message Size bytes을 조정할 수 있습니다.

 

4.2

netperf -H (서버아이피) -j -t (네트워크방식) -- -o (LATENCY TYPE)

 

네트워크 방식으로는 TCP_STREAM, UDP_STREAM, TCP_RR, TCP_CRR, UDP_RR 등이 있습니다. 

 

LATENCY TYPE으로는 50th Percentile Latency Microseconds, 90th Percentile Latency Microseconds, Mean Latency Microseconds ,Stddev Latency Microseconds 등을 P50_LATENCY, P90_LATENCY, MEAN_LATENCY, STDDEV_LATENCY옵션으로 측정 할 수 있습니다.

netperf -H (서버아이피) -j -t TCP_RR -- -o STDDEV_LATENCY
Stddev Latency Microseconds
3550.24

 

참고한 문서 : linux.die.net/man/1/netperf