Test environment

*02.一个TCP的简单实验 - 图1

image.png

https://zhuanlan.zhihu.com/p/170333403
https://muralidba.blogspot.com/2018/04/how-can-i-check-my-network-and-disk-io.html

  1. apt-get install -y netcat-traditional
  2. apt-get install -y iproute2
  3. apt-get install -y iperf3

网络性能

使用的是本机的两台Docker-ubuntu测试

本机测试

  • iperf3 ```shell /# iperf3 -c 172.17.0.2 Connecting to host 172.17.0.2, port 5201 [ 5] local 172.17.0.3 port 49004 connected to 172.17.0.2 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 10.9 GBytes 93.8 Gbits/sec 1082 499 KBytes [ 5] 1.00-2.00 sec 12.0 GBytes 103 Gbits/sec 261 559 KBytes
    [ 5] 2.00-3.00 sec 12.1 GBytes 104 Gbits/sec 422 568 KBytes
    [ 5] 3.00-4.00 sec 12.1 GBytes 104 Gbits/sec 7 708 KBytes
    [ 5] 4.00-5.00 sec 12.1 GBytes 104 Gbits/sec 0 708 KBytes
    [ 5] 5.00-6.00 sec 12.3 GBytes 105 Gbits/sec 312 708 KBytes
    [ 5] 6.00-7.00 sec 12.2 GBytes 105 Gbits/sec 488 376 KBytes
    [ 5] 7.00-8.00 sec 3.77 GBytes 32.4 Gbits/sec 578 420 KBytes
    ^C[ 5] 8.00-8.12 sec 1.50 GBytes 106 Gbits/sec 157 481 KBytes

[ ID] Interval Transfer Bitrate Retr [ 5] 0.00-8.12 sec 89.0 GBytes 94.2 Gbits/sec 3307 sender [ 5] 0.00-8.12 sec 0.00 Bytes 0.00 bits/sec receiver iperf3: interrupt - the client has terminated

  1. ```shell
  2. /# iperf3 -s
  3. -----------------------------------------------------------
  4. Server listening on 5201
  5. -----------------------------------------------------------
  6. Accepted connection from 172.17.0.3, port 49002
  7. [ 5] local 172.17.0.2 port 5201 connected to 172.17.0.3 port 49004
  8. [ ID] Interval Transfer Bitrate
  9. [ 5] 0.00-1.00 sec 10.9 GBytes 93.8 Gbits/sec
  10. [ 5] 1.00-2.00 sec 12.0 GBytes 103 Gbits/sec
  11. [ 5] 2.00-3.00 sec 12.1 GBytes 104 Gbits/sec
  12. [ 5] 3.00-4.00 sec 12.1 GBytes 104 Gbits/sec
  13. [ 5] 4.00-5.00 sec 12.1 GBytes 104 Gbits/sec
  14. [ 5] 5.00-6.00 sec 12.3 GBytes 105 Gbits/sec
  15. [ 5] 6.00-7.00 sec 12.2 GBytes 105 Gbits/sec
  16. [ 5] 7.00-8.00 sec 3.77 GBytes 32.4 Gbits/sec
  17. [ 5] 7.00-8.00 sec 3.77 GBytes 32.4 Gbits/sec
  18. - - - - - - - - - - - - - - - - - - - - - - - - -
  19. [ ID] Interval Transfer Bitrate
  20. [ 5] 0.00-8.00 sec 89.0 GBytes 95.6 Gbits/sec receiver
  21. iperf3: the client has terminated
  22. -----------------------------------------------------------
  23. Server listening on 5201
  • nc, dd
    1. /# nc -vvlnp 12345 >/dev/null
    2. listening on [any] 12345 ...
    3. connect to [172.17.0.2] from (UNKNOWN) [172.17.0.3] 52648
    1. /# dd if=/dev/zero bs=1M count=1K | nc -vvn 172.17.0.2 12345
    2. (UNKNOWN) [172.17.0.2] 12345 (?) open
    3. 1024+0 records in
    4. 1024+0 records out
    5. 1073741824 bytes (1.1 GB, 1.0 GiB) copied, 2.46329 s, 436 MB/s

双机测试

磁盘性能

  1. /home# wget https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/xenial/ubuntu-16.04.7-server-amd64.iso
  2. /home# ls -l
  3. total 901124
  4. -rw-r--r-- 1 root root 922746880 Aug 10 2020 ubuntu-16.04.7-server-amd64.iso
  1. /home# time nc 172.17.0.2 12345 < ubuntu-16.04.7-server-amd64.iso
  2. (UNKNOWN) [172.17.0.2] 12345 (?) : Connection refused

Docker没有打开端口?

  1. /home# dd if=/dev/zero bs=1M count=1K conv=fdatasync of=ubuntu-16.04.7-server-amd64.iso
  2. 1024+0 records in
  3. 1024+0 records out
  4. 1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.773657 s, 1.4 GB/s
  1. /home# ls -l
  2. total 1048580
  3. -rw-r--r-- 1 root root 1073741824 Feb 15 16:20 ubuntu-16.04.7-server-amd64.iso
  4. root@3f1d5b77f46d:/home# irb
  5. irb(main):001:0> 1073741824/0.77365
  6. => 1387890937.7625542
  7. irb(main):002:0> 1073741824/0.77365/100000
  8. => 13878.909377625541
  9. irb(main):003:0>

总结