Тестирование скорости сервера в Linux Ubuntu

Автор: Рудюк С . А.
https://corp2.net

E-Mail: rs@corp2.net

Заметил, что скорость на сервере все время маленькая – почему-то не превышает 10 Мбит/с, в то время, как должна достигать 100 МБит/с. Долго думал, что это из-за того, что у пользователей маленькая скорость, но… Вот у меня локальный интернет 80МБит/с и скорость все настолько же низкая: 0,8-2Мбит/с.

Начал искать причину. Протестировал локальный интернет на своем компьюетере с помощью сайта http://www.speedtest.net/.
Показатели, конечно, меньше 80МБит/с, но в целом – выше на порядок, чем между сервером и локальным компьютером: 20-40Мбит/с…

Как же протестировать сервер ?
Как оказалась, есть такая замечательная команда iperf.

Устанавливаем iperf на сервере:
apt-get install iperf

На клиентском компьютере, если он под Linux выполняем тоже данную команду. В случае же Windows ставим версию для Винды:
http://iperf.ru/wp-content/uploads/2009/07/jperf-2.0.0.zip

Теперь, запускаем на сервере сервис:
iperf -s

Выполняем на клиенте:
iperf -c НазваниеВашегоСервера -P 20
Расшифровка ключей.
-с – указывает на компьютер с которым происходит передача данными.
-P – указывает на количество потоков, которые используются при передаче данных (в нашем случае – 20 потоков).

————————————————————
Client connecting to corp2.net, TCP port 5001
TCP window size: 8.00 KByte (default)
————————————————————
[1760] local 192.168.0.99 port 27951 connected with 77.88.252.136 port 5001
[1696] local 192.168.0.99 port 27955 connected with 77.88.252.136 port 5001
[1664] local 192.168.0.99 port 27957 connected with 77.88.252.136 port 5001
[1808] local 192.168.0.99 port 27948 connected with 77.88.252.136 port 5001
[1792] local 192.168.0.99 port 27949 connected with 77.88.252.136 port 5001
[1632] local 192.168.0.99 port 27959 connected with 77.88.252.136 port 5001
[1840] local 192.168.0.99 port 27946 connected with 77.88.252.136 port 5001
[1776] local 192.168.0.99 port 27950 connected with 77.88.252.136 port 5001
[1600] local 192.168.0.99 port 27961 connected with 77.88.252.136 port 5001
[1552] local 192.168.0.99 port 27964 connected with 77.88.252.136 port 5001
[1728] local 192.168.0.99 port 27953 connected with 77.88.252.136 port 5001
[1568] local 192.168.0.99 port 27963 connected with 77.88.252.136 port 5001
[1744] local 192.168.0.99 port 27952 connected with 77.88.252.136 port 5001
[1712] local 192.168.0.99 port 27954 connected with 77.88.252.136 port 5001
[1680] local 192.168.0.99 port 27956 connected with 77.88.252.136 port 5001
[1648] local 192.168.0.99 port 27958 connected with 77.88.252.136 port 5001
[1616] local 192.168.0.99 port 27960 connected with 77.88.252.136 port 5001
[1856] local 192.168.0.99 port 27945 connected with 77.88.252.136 port 5001
[1824] local 192.168.0.99 port 27947 connected with 77.88.252.136 port 5001
[1584] local 192.168.0.99 port 27962 connected with 77.88.252.136 port 5001
[ ID] Interval       Transfer     Bandwidth
[1792]  0.0-10.0 sec   120 KBytes  98.1 Kbits/sec
[1824]  0.0-10.0 sec   360 KBytes   294 Kbits/sec
[1696]  0.0-10.1 sec   184 KBytes   149 Kbits/sec
[1664]  0.0-10.2 sec   152 KBytes   123 Kbits/sec
[1712]  0.0-10.2 sec  48.0 KBytes  38.6 Kbits/sec
[1808]  0.0-10.3 sec   696 KBytes   556 Kbits/sec
[1616]  0.0-10.3 sec  40.0 KBytes  31.8 Kbits/sec
[1760]  0.0-10.7 sec   448 KBytes   342 Kbits/sec
[1584]  0.0-10.7 sec   320 KBytes   245 Kbits/sec
[1776]  0.0-14.1 sec  32.0 KBytes  18.5 Kbits/sec
[1600]  0.0-14.1 sec  32.0 KBytes  18.5 Kbits/sec
[1840]  0.0-14.2 sec  48.0 KBytes  27.8 Kbits/sec
[1552]  0.0-14.1 sec  32.0 KBytes  18.5 Kbits/sec
[1632]  0.0-15.2 sec  56.0 KBytes  30.3 Kbits/sec
[1648]  0.0-18.1 sec  40.0 KBytes  18.2 Kbits/sec
[1568]  0.0-18.1 sec  32.0 KBytes  14.5 Kbits/sec
[1856]  0.0-18.1 sec  40.0 KBytes  18.1 Kbits/sec
[1680]  0.0-23.0 sec  40.0 KBytes  14.3 Kbits/sec
[1728]  0.0-23.1 sec  40.0 KBytes  14.2 Kbits/sec
[1744]  0.0-23.1 sec  40.0 KBytes  14.2 Kbits/sec
[ ID] Interval       Transfer     Bandwidth
[SUM]  0.0-23.1 sec  2.73 MBytes   993 Kbits/sec

Как видите, скорость и вправду далека от 100МБит/сек. и в нашем случае составила всего 993 КБит/сек…

После того, как обратились к провайдеру, оказалось, что “не правильно срабатывал шейпер”. После снятия его, результаты кардинально улучшились:
————————————————————
Client connecting to srv1.corp2.net, TCP port 5001
TCP window size: 8.00 KByte (default)
————————————————————
[1824] local 192.168.0.99 port 28769 connected with 77.88.252.135 port 5001
[1552] local 192.168.0.99 port 28786 connected with 77.88.252.135 port 5001
[1840] local 192.168.0.99 port 28768 connected with 77.88.252.135 port 5001
[1856] local 192.168.0.99 port 28767 connected with 77.88.252.135 port 5001
[1808] local 192.168.0.99 port 28770 connected with 77.88.252.135 port 5001
[1632] local 192.168.0.99 port 28781 connected with 77.88.252.135 port 5001
[1776] local 192.168.0.99 port 28772 connected with 77.88.252.135 port 5001
[1760] local 192.168.0.99 port 28773 connected with 77.88.252.135 port 5001
[1744] local 192.168.0.99 port 28774 connected with 77.88.252.135 port 5001
[1792] local 192.168.0.99 port 28771 connected with 77.88.252.135 port 5001
[1712] local 192.168.0.99 port 28776 connected with 77.88.252.135 port 5001
[1728] local 192.168.0.99 port 28775 connected with 77.88.252.135 port 5001
[1696] local 192.168.0.99 port 28777 connected with 77.88.252.135 port 5001
[1664] local 192.168.0.99 port 28779 connected with 77.88.252.135 port 5001
[1600] local 192.168.0.99 port 28783 connected with 77.88.252.135 port 5001
[1680] local 192.168.0.99 port 28778 connected with 77.88.252.135 port 5001
[1648] local 192.168.0.99 port 28780 connected with 77.88.252.135 port 5001
[1568] local 192.168.0.99 port 28785 connected with 77.88.252.135 port 5001
[1616] local 192.168.0.99 port 28782 connected with 77.88.252.135 port 5001
[1584] local 192.168.0.99 port 28784 connected with 77.88.252.135 port 5001
[ ID] Interval       Transfer     Bandwidth
[1568]  0.0-10.1 sec  1.77 MBytes  1.47 Mbits/sec
[1744]  0.0-10.1 sec  1.08 MBytes   893 Kbits/sec
[1616]  0.0-10.2 sec  1.55 MBytes  1.27 Mbits/sec
[1680]  0.0-10.2 sec   704 KBytes   564 Kbits/sec
[1584]  0.0-10.2 sec  1.91 MBytes  1.57 Mbits/sec
[1856]  0.0-10.2 sec  1.20 MBytes   981 Kbits/sec
[1552]  0.0-10.2 sec   904 KBytes   723 Kbits/sec
[1760]  0.0-10.2 sec  1.51 MBytes  1.24 Mbits/sec
[1792]  0.0-10.2 sec  1.26 MBytes  1.03 Mbits/sec
[1712]  0.0-10.2 sec  1.70 MBytes  1.39 Mbits/sec
[1776]  0.0-10.2 sec  1.26 MBytes  1.03 Mbits/sec
[1648]  0.0-10.2 sec  1.14 MBytes   938 Kbits/sec
[1728]  0.0-10.2 sec  1.32 MBytes  1.08 Mbits/sec
[1808]  0.0-10.2 sec  1.05 MBytes   858 Kbits/sec
[1824]  0.0-10.3 sec  1.51 MBytes  1.23 Mbits/sec
[1696]  0.0-10.3 sec  1.70 MBytes  1.39 Mbits/sec
[1600]  0.0-10.3 sec  1.75 MBytes  1.43 Mbits/sec
[1840]  0.0-10.3 sec  1.44 MBytes  1.17 Mbits/sec
[1664]  0.0-10.3 sec  1.34 MBytes  1.09 Mbits/sec
[1632]  0.0-11.4 sec  1.67 MBytes  1.23 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[SUM]  0.0-11.4 sec  27.7 MBytes  20.4 Mbits/sec

А между серверами внутри провайдера достигает практически максимум (раньше было до 2 МБит/с):

iperf -c srv1.corp2.net -P 20
————————————————————
Client connecting to srv1.corp2.net, TCP port 5001
TCP window size: 16.0 KByte (default)
————————————————————
[ 19] local 77.88.252.136 port 42503 connected with 77.88.252.135 port 5001
[  8] local 77.88.252.136 port 42485 connected with 77.88.252.135 port 5001
[  9] local 77.88.252.136 port 42484 connected with 77.88.252.135 port 5001
[  3] local 77.88.252.136 port 42487 connected with 77.88.252.135 port 5001
[  6] local 77.88.252.136 port 42486 connected with 77.88.252.135 port 5001
[  5] local 77.88.252.136 port 42488 connected with 77.88.252.135 port 5001
[  7] local 77.88.252.136 port 42489 connected with 77.88.252.135 port 5001
[ 10] local 77.88.252.136 port 42490 connected with 77.88.252.135 port 5001
[  4] local 77.88.252.136 port 42492 connected with 77.88.252.135 port 5001
[ 13] local 77.88.252.136 port 42491 connected with 77.88.252.135 port 5001
[ 11] local 77.88.252.136 port 42493 connected with 77.88.252.135 port 5001
[ 14] local 77.88.252.136 port 42494 connected with 77.88.252.135 port 5001
[ 12] local 77.88.252.136 port 42495 connected with 77.88.252.135 port 5001
[ 16] local 77.88.252.136 port 42496 connected with 77.88.252.135 port 5001
[ 15] local 77.88.252.136 port 42498 connected with 77.88.252.135 port 5001
[ 18] local 77.88.252.136 port 42497 connected with 77.88.252.135 port 5001
[ 17] local 77.88.252.136 port 42499 connected with 77.88.252.135 port 5001
[ 21] local 77.88.252.136 port 42500 connected with 77.88.252.135 port 5001
[ 22] local 77.88.252.136 port 42501 connected with 77.88.252.135 port 5001
[ 20] local 77.88.252.136 port 42502 connected with 77.88.252.135 port 5001
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec  7.79 MBytes  6.53 Mbits/sec
[ 10]  0.0-10.0 sec  8.04 MBytes  6.73 Mbits/sec
[ 14]  0.0-10.0 sec  6.90 MBytes  5.77 Mbits/sec
[ 13]  0.0-10.0 sec  8.16 MBytes  6.81 Mbits/sec
[ 15]  0.0-10.0 sec  7.19 MBytes  6.00 Mbits/sec
[ 18]  0.0-10.1 sec  7.20 MBytes  6.00 Mbits/sec
[ 21]  0.0-10.1 sec  7.34 MBytes  6.12 Mbits/sec
[  7]  0.0-10.1 sec  2.73 MBytes  2.27 Mbits/sec
[ 11]  0.0-10.1 sec  7.27 MBytes  6.04 Mbits/sec
[  3]  0.0-10.1 sec  10.6 MBytes  8.83 Mbits/sec
[  5]  0.0-10.1 sec  2.95 MBytes  2.45 Mbits/sec
[ 17]  0.0-10.1 sec  7.20 MBytes  5.96 Mbits/sec
[  6]  0.0-10.2 sec  9.50 MBytes  7.85 Mbits/sec
[ 20]  0.0-10.2 sec  2.42 MBytes  1.99 Mbits/sec
[ 12]  0.0-10.2 sec  7.15 MBytes  5.88 Mbits/sec
[ 22]  0.0-10.2 sec  2.22 MBytes  1.82 Mbits/sec
[  8]  0.0-10.3 sec  2.37 MBytes  1.93 Mbits/sec
[  9]  0.0-10.3 sec  3.23 MBytes  2.62 Mbits/sec
[ 16]  0.0-10.4 sec  4.59 MBytes  3.69 Mbits/sec
[ 19]  0.0-10.4 sec  2.66 MBytes  2.13 Mbits/sec
[SUM]  0.0-10.4 sec    118 MBytes  94.4 Mbits/sec

94,4 Мбит/с – это отличный показатель!

Be the first to comment

Leave a Reply

Your email address will not be published.


*