Всем привет!
Время от времени всем нам приходится делать анализ сетевой инфраструктуры, чтобы узнать узкие места сети. Если говорить об офисном окружении, то в сети как правило есть файловый сервер и косвенную оценку сети часто проводят измеряя скорость записи-чтения файла(ов) на сервер. Такая оценка не может быть объективной, т.к. на нее накладывается производительность файловой системы и т.п. Поэтому предлагаю не предвзятый тест оценки скорости сети.
Будем мерить скорость с помощью клиент-серверной утилиты iperf3. Программа кроссплатформенная, можно установить на:
- Linux
- FreeBSD
- MacOS
- Windows
Так же с ее помощью можно имитировать различный трафик по времени и скорости соединения, как TCP, так и UDP.
Итак, в качестве сервера будет использован хост с FreeBSD 11.2, в качестве клиента хост с Win7.
Ставим на FreeBSD через порты (мне так привычнее:))
# cd /usr/ports/benchmarks/iperf3 # make install clean
И запускаем как сервер (ключ -s):
# iperf3 -s ----------------------------------------------------------- Server listening on 5201 -----------------------------------------------------------
Скачиваем и распаковываем на Windows бинарную сборку
Обращаем внимание, что iperf3 ≠ iperf2 ≠ iperf1, нам нужен iperf3.
Переходим с помощью CMD или FarManager в распакованную директорию и запускаем iperf3 с ключом -c
iperf-3.1.3-win64>iperf3.exe -c 10.200.6.25 Connecting to host 10.200.6.25, port 5201 [ 4] local 10.200.6.53 port 61811 connected to 10.200.6.25 port 5201 [ ID] Interval Transfer Bandwidth [ 4] 0.00-1.00 sec 83.6 MBytes 701 Mbits/sec [ 4] 1.00-2.00 sec 103 MBytes 863 Mbits/sec [ 4] 2.00-3.00 sec 104 MBytes 868 Mbits/sec [ 4] 3.00-4.00 sec 98.6 MBytes 827 Mbits/sec [ 4] 4.00-5.00 sec 78.4 MBytes 657 Mbits/sec [ 4] 5.00-6.00 sec 40.2 MBytes 338 Mbits/sec [ 4] 6.00-7.00 sec 80.1 MBytes 672 Mbits/sec [ 4] 7.00-8.00 sec 106 MBytes 890 Mbits/sec [ 4] 8.00-9.00 sec 107 MBytes 900 Mbits/sec [ 4] 9.00-10.00 sec 98.6 MBytes 827 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth [ 4] 0.00-10.00 sec 899 MBytes 754 Mbits/sec sender [ 4] 0.00-10.00 sec 899 MBytes 754 Mbits/sec receiver iperf Done.
Видим что отправили за 10 секунд 899 мегабайт со скоростью 754Mbit/sec
На сервере видим похожую картину
Accepted connection from 10.200.6.53, port 61810 [ 5] local 10.200.6.25 port 5201 connected to 10.200.6.53 port 61811 [ ID] Interval Transfer Bitrate [ 5] 0.00-1.00 sec 83.6 MBytes 700 Mbits/sec [ 5] 1.00-2.00 sec 103 MBytes 863 Mbits/sec [ 5] 2.00-3.00 sec 104 MBytes 868 Mbits/sec [ 5] 3.00-4.00 sec 98.6 MBytes 827 Mbits/sec [ 5] 4.00-5.00 sec 78.4 MBytes 658 Mbits/sec [ 5] 5.00-6.00 sec 40.0 MBytes 335 Mbits/sec [ 5] 6.00-7.00 sec 80.5 MBytes 675 Mbits/sec [ 5] 7.00-8.00 sec 106 MBytes 890 Mbits/sec [ 5] 8.00-9.00 sec 107 MBytes 899 Mbits/sec [ 5] 9.00-10.00 sec 98.7 MBytes 828 Mbits/sec [ 5] 10.00-10.00 sec 182 KBytes 860 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate [ 5] 0.00-10.00 sec 899 MBytes 754 Mbits/sec receiver
Где видим, что сервер получил такое же количество данных на такой же скорости.
Для теста получения на клиенте используем ключ -R (Revers)
iperf3.exe -c 10.200.6.25 -R Connecting to host 10.200.6.25, port 5201 Reverse mode, remote host 10.200.6.25 is sending [ 4] local 10.200.6.53 port 4494 connected to 10.200.6.25 port 5201 [ ID] Interval Transfer Bandwidth [ 4] 0.00-1.00 sec 69.1 MBytes 579 Mbits/sec [ 4] 1.00-2.00 sec 105 MBytes 882 Mbits/sec [ 4] 2.00-3.00 sec 107 MBytes 895 Mbits/sec [ 4] 3.00-4.00 sec 106 MBytes 891 Mbits/sec [ 4] 4.00-5.00 sec 105 MBytes 883 Mbits/sec [ 4] 5.00-6.00 sec 66.4 MBytes 557 Mbits/sec [ 4] 6.00-7.00 sec 110 MBytes 920 Mbits/sec [ 4] 7.00-8.00 sec 104 MBytes 876 Mbits/sec [ 4] 8.00-9.00 sec 100 MBytes 840 Mbits/sec [ 4] 9.00-10.00 sec 96.2 MBytes 807 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth Retr [ 4] 0.00-10.00 sec 970 MBytes 814 Mbits/sec 0 sender [ 4] 0.00-10.00 sec 970 MBytes 814 Mbits/sec receiver iperf Done.
При этом видим, что на сервере данный в этот раз отправлялись (sender), а не принимались:
# iperf3 -s ----------------------------------------------------------- Server listening on 5201 ----------------------------------------------------------- Accepted connection from 10.200.6.53, port 4493 [ 5] local 10.200.6.25 port 5201 connected to 10.200.6.53 port 4494 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 69.3 MBytes 581 Mbits/sec 0 208 KBytes [ 5] 1.00-2.00 sec 105 MBytes 882 Mbits/sec 0 208 KBytes [ 5] 2.00-3.00 sec 107 MBytes 894 Mbits/sec 0 208 KBytes [ 5] 3.00-4.00 sec 106 MBytes 892 Mbits/sec 0 208 KBytes [ 5] 4.00-5.00 sec 105 MBytes 883 Mbits/sec 0 208 KBytes [ 5] 5.00-6.00 sec 66.5 MBytes 557 Mbits/sec 0 208 KBytes [ 5] 6.00-7.00 sec 110 MBytes 920 Mbits/sec 0 208 KBytes [ 5] 7.00-8.00 sec 104 MBytes 876 Mbits/sec 0 208 KBytes [ 5] 8.00-9.00 sec 100 MBytes 840 Mbits/sec 0 208 KBytes [ 5] 9.00-10.00 sec 95.8 MBytes 803 Mbits/sec 0 208 KBytes [ 5] 10.00-10.04 sec 608 KBytes 119 Mbits/sec 0 208 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.04 sec 970 MBytes 810 Mbits/sec 0 sender ----------------------------------------------------------- Server listening on 5201
Собственно наверное и все, что хотел рассказать:)
P.S. У программы есть много ключей запуска с помощью которых можно симулировать трафик (скорость, время, UDP или TCP)
# iperf3
iperf3: parameter error - must either be a client (-c) or server (-s)
Usage: iperf3 [-s|-c host] [options]
iperf3 [-h|--help] [-v|--version]
Server or Client:
-p, --port # server port to listen on/connect to
-f, --format [kmgtKMGT] format to report: Kbits, Mbits, Gbits, Tbits
-i, --interval # seconds between periodic throughput reports
-F, --file name xmit/recv the specified file
-A, --affinity n/n,m set CPU affinity
-B, --bind <host> bind to the interface associated with the address <host>
-V, --verbose more detailed output
-J, --json output in JSON format
--logfile f send output to a log file
--forceflush force flushing output at every interval
-d, --debug emit debugging output
-v, --version show version information and quit
-h, --help show this message and quit
Server specific:
-s, --server run in server mode
-D, --daemon run the server as a daemon
-I, --pidfile file write PID file
-1, --one-off handle one client connection then exit
--rsa-private-key-path path to the RSA private key used to decrypt
authentication credentials
--authorized-users-path path to the configuration file containing user
credentials
Client specific:
-c, --client <host> run in client mode, connecting to <host>
--sctp use SCTP rather than TCP
-X, --xbind <name> bind SCTP association to links
--nstreams # number of SCTP streams
-u, --udp use UDP rather than TCP
--connect-timeout # timeout for control connection setup (ms)
-b, --bitrate #[KMG][/#] target bitrate in bits/sec (0 for unlimited)
(default 1 Mbit/sec for UDP, unlimited for TCP)
(optional slash and packet count for burst mode)
--pacing-timer #[KMG] set the timing for pacing, in microseconds (default 1000)
-t, --time # time in seconds to transmit for (default 10 secs)
-n, --bytes #[KMG] number of bytes to transmit (instead of -t)
-k, --blockcount #[KMG] number of blocks (packets) to transmit (instead of -t or -n)
-l, --length #[KMG] length of buffer to read or write
(default 128 KB for TCP, dynamic or 1460 for UDP)
--cport <port> bind to a specific client port (TCP and UDP, default: ephemeral port)
-P, --parallel # number of parallel client streams to run
-R, --reverse run in reverse mode (server sends, client receives)
-w, --window #[KMG] set window size / socket buffer size
-C, --congestion <algo> set TCP congestion control algorithm (Linux and FreeBSD only)
-M, --set-mss # set TCP/SCTP maximum segment size (MTU - 40 bytes)
-N, --no-delay set TCP/SCTP no delay, disabling Nagle's Algorithm
-4, --version4 only use IPv4
-6, --version6 only use IPv6
-S, --tos N set the IP type of service, 0-255.
The usual prefixes for octal and hex can be used,
i.e. 52, 064 and 0x34 all specify the same value.
--dscp N or --dscp val set the IP dscp value, either 0-63 or symbolic.
Numeric values can be specified in decimal,
octal and hex (see --tos above).
-Z, --zerocopy use a 'zero copy' method of sending data
-O, --omit N omit the first n seconds
-T, --title str prefix every output line with this string
--extra-data str data string to include in client and server JSON
--get-server-output get results from server
--udp-counters-64bit use 64-bit counters in UDP test packets
--repeating-payload use repeating pattern in payload, instead of
randomized payload (like in iperf2)
--username username for authentication
--rsa-public-key-path path to the RSA public key used to encrypt
authentication credentials
[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-
iperf3 homepage at: https://software.es.net/iperf/
Report bugs to: https://github.com/esnet/iperf