Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1877752
  • 博文数量: 376
  • 博客积分: 2147
  • 博客等级: 大尉
  • 技术积分: 3642
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-06 10:47
文章分类

全部博文(376)

文章存档

2019年(3)

2017年(28)

2016年(15)

2015年(17)

2014年(182)

2013年(16)

2012年(115)

我的朋友

分类: LINUX

2012-09-21 17:59:00

TCP testing in Linux is an continuous process. These tests are concerned with the behavior and correctness of the TCP protocol in the Linux kernel.

More will be added to this page soon.

Contents

Many tools are available for building TCP tests, but some of the basic ones are:

  a simple client/server test application.
  kernel module that creates a way to see TCP endpoint state changes
  emulate long delays, packet loss etc.

When running TCP experiments over high (BDP) you probably want to change the maximum available TCP window size. TCP tuning is done via parameters documented in (or Documentation/networking/ip-sysctl.txt) see for more info.
At a minimum increase tcp_rmem[2] for receiver and tcp_wmem[2] for sender to twice the BDP.

If the test involves repeated connections, you should also turn off the route metrics:

sysctl -w net.ipv4.tcp_no_metrics_save=1

Normally Linux will remember the last threshold (ssthresh). This modifies the result of the second test, and causes errors.


The purpose of congestion control tests is to observe how the congestion window changes with different network conditions. These tests have lots of possible variables and there is no one "right answer".

A basic test would be:

  1. Start iperf server on the receiver
iperf -s
  1. Insert tcp_probe module (as root) on sending machine and filter for iperf port. You can change the mode to allow non-root user access
modprobe tcp_probe port=5001 chmod 444 /proc/net/tcpprobe
  1. Capture tcp probe output (on sender) and place in background
cat /proc/net/tcpprobe >/tmp/tcpprobe.out & TCPCAP=$!
  1. Run iperf test on sender for 15minutes
iperf -i 10 -t 300 -c receiver
  1. Kill capture process
kill $TCPCAP

The tcp probe capture file will contain one line for each packet sent.

0.073678 10.8.0.54:38644 192.168.1.42:5001 24 0xb6b19bb 0xb6b19bb 2 2147483647 5792 ^ ^ ^ ^ ^ ^ ^ ^ ^ | | | | | | | | +- [9] Send window | | | | | | | +------------ [8] Slow start threshold | | | | | | +-------------- [7] Congestion window | | | | | +------------------------ [6] Unacknowledged sequence # | | | | +---------------------------------- [5] Next send sequence # | | | +------------------------------------- [4] Bytes in packet | | +------------------------------------------------------- [3] Receiver address:port | +----------------------------------------------------------------------- [2] Sender address:port +-------------------------------------------------------------------------------- [1] Time seconds * The value of slow start threshold here is (-1) which means it hasn't been determined yet * Time since Tcp probe was loaded.

This text file can be easily filtered and modified with standard tools such as and . A common usage is to make a plot of congestion window and slow start threshold over time using .

$ gnuplot -persist <<"EOF" set data style linespoints show timestamp set xlabel "time (seconds)" set ylabel "Segments (cwnd, ssthresh)" plot "/tmp/tcpprobe.out" using 1:7 title "snd_cwnd", \ "/tmp/tcpprobe.out" using 1:($8>=2147483647 ? 0 : $8) title "snd_ssthresh" EOF

The result should look something like this:
cubic.png

A set of scripts to run test like this and plot are available [1]

There are many possible factors that can be evaluated in any test.
For a good discussion of the issues see the paper:
and .

Algorithim  Linux provides many congestion control algorithms now.
BDP  TCP needs to adapt to a wide range of band-width delay products
Loss  TCP should recover from moderate loss, but since most congestion control algorithms use loss to estimate BDP; they have trouble distinguishing random packet loss from router queue overflow packet drop.
Fairness  Define fairness and how to measure it
Background traffic
Describe how to add background traffic via harpoon here

On Linux TCP should be able to fully saturate the network given a sufficiently fast CPU and bus for a single connection. Some useful tools are:

  • allow for measuring CPU utilization
  • for measuring lots of web connections
  • curl-loader web traffic generation (HTTP/S, FTP/S) with 10-20K and more real HTTP sessions

See also .

There are (expensive) TCP protocol validation suites.

is a useful way to find unexpected bugs in the TCP processing.
is a suite of utilities to exercise the stability of an IP Stack and its component stacks (TCP, UDP, ICMP et. al.)

阅读(1416) | 评论(0) | 转发(0) |
0

上一篇:traceroute

下一篇:performance_testing

给主人留下些什么吧!~~