티스토리 뷰

Network/System&Tools

sockperf

Jacob_baek 2022. 1. 5. 18:19

sockperf란

성능 테스팅을 위해 설계된 socket API를 기반으로 한 네트워크 벤치마킹 도구이다.

sockperf build

별도의 binary 파일을 제공하고 있지 않기에 ubuntu 기준으로 다음과 같이 build를 하여 sockperf binary를 만들어 사용한다.

sudo apt install perl make automake autoconf m4 libtool-bin g++
./autogen.sh  (only when cloning from repository)
./configure
make && make install

빌드 당시 사용했던 OS 버전은 ubuntu 20.04 이다.

sockperf 사용

서버/클라이언트 구조로 동작된다.
먼저 sockperf의 help 를 확인해보면

ubuntu@ubuntu-instance:~$ ./sockperf -h
sockperf is a tool for testing network latency and throughput.
version 3.7-17.gite92a8703a2ca

Usage: sockperf <subcommand> [options] [args]
Type: 'sockperf <subcommand> --help' for help on a specific subcommand.
Type: 'sockperf --version' to see the program version number.

Available subcommands:
   help (h ,?)          Display list of supported commands.
   under-load (ul)      Run sockperf client for latency under load test.
   ping-pong (pp)       Run sockperf client for latency test in ping pong mode.
   playback (pb)        Run sockperf client for latency test using playback of predefined traffic, based on timeline and message size.
   throughput (tp)      Run sockperf client for one way throughput test.
   server (sr)          Run sockperf as a server.

For additional information visit our website http://github.com/mellanox/sockperf , see README file, or Type 'sockperf <subcommand> --help'.

위와 같으며 여기서는 sr(server)와 pp(ping-ping)을 통해 latency 측정에 대하여 알아보려 한다.

sockperf server

기본으로 11111 포트로 동작하며 UDP로 동작된다.

root@ubuntu-server:/home/ubuntu# sockperf sr -i 0.0.0.0
sockperf: == version #3.7-17.gite92a8703a2ca ==
sockperf: [SERVER] listen on:
[ 0] IP = 0.0.0.0         PORT = 11111 # UDP
sockperf: Warmup stage (sending a few dummy messages)...
sockperf: [tid 4313] using recvfrom() to block on socket(s) 

필요에 따라 TCP로 동작시킬 수 있다.

root@ubuntu-server:/home/ubuntu# sockperf sr -i 0.0.0.0 --tcp
sockperf: == version #3.7-17.gite92a8703a2ca ==
sockperf: [SERVER] listen on:
[ 0] IP = 0.0.0.0         PORT = 11111 # TCP
sockperf: Warmup stage (sending a few dummy messages)...
sockperf: [tid 4316] using recvfrom() to block on socket(s)

sockperf client

앞서 동작시킨 서버쪽 IP를 대상으로 아래와 같은 명령을 수행한다.

ubuntu@ubuntu-client:~$ ./sockperf pp -i 1.2.3.4 --tcp
sockperf: == version #3.7-17.gite92a8703a2ca ==
sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)

[ 0] IP = 1.2.3.4  PORT = 11111 # TCP
sockperf: Warmup stage (sending a few dummy messages)...
sockperf: Starting test...
sockperf: Test end (interrupted by timer)
sockperf: Test ended
sockperf: [Total Run] RunTime=1.000 sec; Warm up time=400 msec; SentMessages=697; ReceivedMessages=696
sockperf: ========= Printing statistics for Server No: 0
sockperf: [Valid Duration] RunTime=0.550 sec; SentMessages=382; ReceivedMessages=382
sockperf: ====> avg-latency=719.372 (std-dev=33.144, mean-ad=17.235, median-ad=16.342, siqr=11.008, cv=0.046, std-error=1.696, 99.0% ci=[715.004, 723.740])
sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
sockperf: Summary: Latency is 719.372 usec
sockperf: Total 382 observations; each percentile contains 3.82 observations
sockperf: ---> <MAX> observation = 1138.778
sockperf: ---> percentile 99.999 = 1138.778
sockperf: ---> percentile 99.990 = 1138.778
sockperf: ---> percentile 99.900 = 1138.778
sockperf: ---> percentile 99.000 =  782.377
sockperf: ---> percentile 90.000 =  741.720
sockperf: ---> percentile 75.000 =  726.397
sockperf: ---> percentile 50.000 =  715.671
sockperf: ---> percentile 25.000 =  704.380
sockperf: ---> <MIN> observation =  675.846

여기서 출력되는 측정 단위는 nanosecond 이다.

여기서 방화벽 allow 작업을 필히 해주어야 한다.

sockperf throughput 측정

추가로 tp 온셥을 통해 throughput 측정도 가능하다.

ubuntu@ubuntu-client:~$ ./sockperf tp -i 1.2.3.4 --tcp
sockperf: == version #3.7-17.gite92a8703a2ca ==
sockperf[CLIENT] send on:
[ 0] IP = 1.2.3.4  PORT = 11111 # TCP
sockperf: Warmup stage (sending a few dummy messages)...
sockperf: Starting test...
sockperf: Test end (interrupted by timer)
sockperf: Test ended
sockperf: Total of 389909 messages sent in 1.019 sec

sockperf: NOTE: test was performed, using msg-size=14. For getting maximum throughput consider using --msg-size=1472
sockperf: Summary: Message Rate is 382453 [msg/sec]
sockperf: Summary: BandWidth is 5.106 MBps (40.850 Mbps)

참고사이트

'Network > System&Tools' 카테고리의 다른 글

iptables for NAT loopback  (0) 2020.09.09
How to use a proxy server as a client  (0) 2019.06.12
iperf  (0) 2018.11.07
Cisco IOS SSH Enabling  (0) 2017.09.28
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함